Giter Club home page Giter Club logo

Comments (9)

0xadada avatar 0xadada commented on July 19, 2024 1

Same here

$ ember-i18n-intl-migrator
SyntaxError: Unexpected token import
    at new Function (<anonymous>)
    at Object.locales.forEach (/Users/0xadada/.config/yarn/global/node_modules/ember-i18n-intl-migrator/lib/translation-transform.js:12:15)
    at Array.forEach (<anonymous>)
    at module.exports (/Users/0xadada/.config/yarn/global/node_modules/ember-i18n-intl-migrator/lib/translation-transform.js:10:11)
    at Object.<anonymous> (/Users/0xadada/.config/yarn/global/node_modules/ember-i18n-intl-migrator/bin/ember-i18n-intl-migrator.js:10:3)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
$ ember --version --verbose
ember-cli: 3.4.3
http_parser: 2.8.0
node: 8.12.0
v8: 6.2.414.66
uv: 1.19.2
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.32.0
napi: 3
openssl: 1.0.2p
icu: 60.1
unicode: 10.0
cldr: 32.0
tz: 2017c
os: darwin x64

looks like for each local it is rewriting, it barfs on my imports in the translations.js file. I split my translations into other files for maintainability.
app/locales/en/translations.js

/* eslint-disable quotes, quote-props */

/* locale: en-US - US English */
import app from "./app";  // <= dies on this type of import statement
import about from "./about";
import common from "./common";
import components from "./components";
import errors from "./errors";
import routes from "./routes";
import validations from "./validations";

export default {
  app,
  about,
  common,
  components,
  errors,
  routes,
  validations
};

from ember-i18n-to-intl-migrator.

sbsurf avatar sbsurf commented on July 19, 2024 1

I gave up on using this tool, and migrated things myself. Not too terrible.

from ember-i18n-to-intl-migrator.

snewcomer avatar snewcomer commented on July 19, 2024

@scottkidder Do you have the same setup as @0xadada?

from ember-i18n-to-intl-migrator.

sbsurf avatar sbsurf commented on July 19, 2024

I also get the SyntaxError: Unexpected token import exception. My set up is similar to @0xadada's, except I keep my translations in .json files. I import them with the help of ember-cli-json-module.

My translations.js file looks like:

import Ember from "ember";
import coreFile from "./core";    // core.json file
import targetFile from "./t";       // t.json file

export default Ember.merge(coreFile, targetFile);

from ember-i18n-to-intl-migrator.

scottkidder avatar scottkidder commented on July 19, 2024

I only have one import and everything else is in translations.js

import validations from "./validations";

export default {
  validations,
  "accept": "Accept",
  "foo": "Foo",
  "bar": {
     "baz"
  }

from ember-i18n-to-intl-migrator.

scottkidder avatar scottkidder commented on July 19, 2024

Any ideas here? From ember-intl docs I gather that we don't need to use this trick and should be able to nest our resources in subdirectories to be auto-discovered. Is that correct?

from ember-i18n-to-intl-migrator.

lookininward avatar lookininward commented on July 19, 2024

Still getting 'SyntaxError: Unexpected token import'

from ember-i18n-to-intl-migrator.

scottkidder avatar scottkidder commented on July 19, 2024

Yeah, I ended up doing the the same @sbsurf. It seems ember-intl supports importing nested directions inside translations/ so doing an import isn't really necessary. json2yaml worked great for converting to yaml with very little manual work.

from ember-i18n-to-intl-migrator.

scottkidder avatar scottkidder commented on July 19, 2024

I'm going to close this, but maybe there should be a bit of documentation on not supporting the various setups mentioned here.

from ember-i18n-to-intl-migrator.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.