Comments (9)
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.
I gave up on using this tool, and migrated things myself. Not too terrible.
from ember-i18n-to-intl-migrator.
@scottkidder Do you have the same setup as @0xadada?
from ember-i18n-to-intl-migrator.
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.
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.
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.
Still getting 'SyntaxError: Unexpected token import'
from ember-i18n-to-intl-migrator.
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.
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)
- YAML conversion issues HOT 2
- Note: touchy about code in translations.js files HOT 1
- Replace translationMacro
- The codemode i18n -> intl is removing too many spaces HOT 1
- Translation Transform is missing the 'two' plural category HOT 1
- Cannot use import statement outside a module HOT 4
- TypeError: Cannot convert undefined or null to object HOT 2
- quotes around yaml keys with dot notation HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ember-i18n-to-intl-migrator.