octri / ember-i18next Goto Github PK
View Code? Open in Web Editor NEWIntegrates i18next into Ember CLI apps.
License: MIT License
Integrates i18next into Ember CLI apps.
License: MIT License
There is currently no mechanism for loading i18next plugins aside from the XHR resource loader, which is loaded by default. See the TODO in i18n.js#_initLibrary
.
We need some way to configure the set of plugins that will be loaded, then the _initLibrary
function will have to use()
each of them before calling init
.
npm version is from this january (https://www.npmjs.com/package/ember-i18next), and is a wrapper of the v1.7 of i18next
current github version brings it up to v3.3 of i18next.
I've updated my bower.json to "i18next": "^3.3.1",
and package.json to "ember-i18next": "git+https://github.com/OCTRI/ember-i18next.git#8185d1d79c62af3fbd7682670821121304cfc2f0",
also made the changes to the environment.js (as pre https://github.com/OCTRI/ember-i18next#configuring-i18next) and to the ember-cli-build.js
(as pre https://github.com/OCTRI/ember-i18next#including-locale-files)
but on running (after npm install, bower install) ember server, I get a broccoli build error.
ember-cli: 2.6.2
node: 4.4.5
os: darwin x64
what else is needed, to use the most recent ember-i18next? (also, any change of updating the npm repo?)
I think the macro idea from ember-i18n
is really neat: https://github.com/jamesarosen/ember-i18n/wiki/Doc:-Translating-Text#translation-computed-property-macro
It would be nice to have that here too. For now I ported the code to my project but if it is something you want maybe I can work on a PR.
The current implementation of the i18n service encourages accessing its i18next
property to use functions in i18next. For better encapsulation, the service should expose most of the i18next API and forward the calls to the library.
Document the use of the new pre- and post-init actions in README.md.
When bound parameters are passed into the t
Handlebars helper, the output is [object Object]
. For instance, in a test like the following where testarg
is __count__ frogs
in the 'en' locale and model.count
is 1000
the browser displays [object Object]
instead of the expected '1000 frogs'.
The browser may be displaying the result of calling toString
on the stream returned from the helper, rather than the stream's value. Debugging code shows that the stream's value function is never called.
Changing the helper to unbound allows it to display '1000 frogs', but as expected the count does not update when the model is changed.
Using Ember.js 1.12 setting the property
this.set('i18n.locale', 'fr');
changed the language the app is displayed in.
Beginning with version 1.13 this doesn't work anymore.
Thank you for all your work!
I would like to use Initializers in my Ember 2.2 Application to load a default language and inject 'i18n' in routes and controllers. Could you provide an example? Thank you
Document expectations for contributions in a CONTRIBUTIONS.md file and add a pull request template.
ember-i18next/addon/helpers/t.js
Line 2 in b1b35cb
For 4.x compatibility this should be imported from @ember/template not @ember/string..
Document the upgrade to ember-i18next 2.x, including the following:
Does this library support variable replacement?
I tried to do something like {{t "hi" firstName=model.firstName}}
and then the translation looks like: Hi {{firstName}}
. But this does not work, the rendered string is Hi
(without the first name part).
If I happen to use a static string though it works just fine. So I suspect that the library does not observe changes on the value passed.
Investigate updating the i18next dependency to 2.x and adjusting the code as needed.
Migration guide: http://i18next.com/docs/migration/
File: helpers/t.js:26
var view = env.data.view;
The env.data object does not exist anymore. This should work:
var view = env.view;
At t.js
...
const path = params.shift(); cause below error at ember 2.9.0
...
Cannot add/remove sealed array elements
Currently using this library as ember-i18n lacks some of the functionality we already use from i18next. Trying to write integration tests with some of our components but cannot work out how to initialise the i18n service to be utilised as part of the tests.
Cheers
Howdy, just saw your extension show up on EmberAddons. I'm starting to notice a huge selection of i18n extensions ;-)
Is there any chance you might be able to collaborate with the other extensions that are working on this as well so we don't all duplicate effort?
I opened a similar issue here: ember-intl/ember-intl#109 and it looks like we might end up with one super-nice extension if we could all do this jointly ...
Interested in your thoughts ...
Investigate the feasibility of implementing a test helper that initializes i18next, as suggested in #31. May be as simple as wrapping the code documented in that issue.
The code should be updated to use ES2015 syntax wherever possible:
var
The signature of Ember.warn
was changed to require an options hash with an error ID. Calls without an error ID now produce deprecations. All instances of Ember.warn
should be changed to either provide the ID or replaced with calls to Ember.Logger.warn
/ Ember.Logger.error
Attempted to pull in the ember addon via "ember install ember-i18next" command which seems to correctly download and install dependencies...seeing new references in both the package.json and bower.json alongside the required files. However on running the "ember server" command the build falls over with the following error...
Serving on http://localhost:4200/
ENOENT, no such file or directory 'D:\work\EmberClient\tmp\concat_with_maps-input_base_path-mqBZ53JP.tmp\0\bower_components\i18next\i18next.js'
Error: ENOENT, no such file or directory 'D:\work\EmberClient\tmp\concat_with_maps-input_base_path-mqBZ53JP.tmp\0\bower_components\i18next\i18next.js'
at Error (native)
at Object.fs.statSync (fs.js:797:18)
at ConcatWithMaps.keyForFile (D:\work\EmberClient\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\index.js:90:20)
at Array.map (native)
at ConcatWithMaps.CachingWriter._conditionalBuild (D:\work\EmberClient\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writ
at D:\work\EmberClient\node_modules\ember-cli\node_modules\broccoli-sourcemap-concat\node_modules\broccoli-caching-writer\node_modules\broccoli-plugin\read_compat.js:6
at lib$rsvp$$internal$$tryCatch (D:\work\EmberClient\node_modules\ember-cli\node_modules\rsvp\dist\rsvp.js:493:16)
at lib$rsvp$$internal$$invokeCallback (D:\work\EmberClient\node_modules\ember-cli\node_modules\rsvp\dist\rsvp.js:505:17)
at lib$rsvp$$internal$$publish (D:\work\EmberClient\node_modules\ember-cli\node_modules\rsvp\dist\rsvp.js:476:11)
at lib$rsvp$asap$$flush (D:\work\EmberClient\node_modules\ember-cli\node_modules\rsvp\dist\rsvp.js:1198:9)
Version info...
Ember : 1.13.11
Ember Data : 1.13.15
jQuery : 1.11.3
In Ember 1.11, the this
pointer is undefined in helpers as a result of this commit:
The tHelper
function should detect this and respond appropriately so the addon will work with both Ember 1.10.x and Ember 1.11.x.
With i18next 1.10.X and 1.11.X, initLibraryAsync
will log a warning about rejected promises if any locale files are missing. For instance, if the app provides an en-US locale file, but no generic en locale file, en.json will cause a 404, triggering the warning. This does not happen with i18next 1.9 and earlier.
Look into the impact of the rejected promise and what can be done to prevent it.
Could be obsoleted by #27, which will convert the addon to use i18next 2.X.
Hey,
I'm starting a new Ember project and investigating which i18n solution to use. I still like i18next
and was wondering where this project stands. Is it still maintained? Do you want collaborators?
1/ I would like to support loading translation files for pod
like structures. A little bit like css-modules
let us have style close to the component, I would see the same thing for locale
files.
2/ I would like to bake i18next-parser
into this add-on. The idea is to have a way to automatically manage the local files, add new keys and remove old ones.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.