Coder Social home page Coder Social logo

octri / ember-i18next Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 8.0 5.44 MB

Integrates i18next into Ember CLI apps.

License: MIT License

JavaScript 93.29% HTML 4.42% CSS 0.07% Handlebars 2.22%
addon ember ember-cli i18n i18next javascript translation

ember-i18next's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar ember-tomster avatar heathharrelson avatar iirving avatar john-coffey avatar karellm avatar kidgodzilla avatar kirenotneb avatar mpirio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ember-i18next's Issues

Fix Ember.warn Deprecations

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

ES2015 Conversion

The code should be updated to use ES2015 syntax wherever possible:

  • eliminate the use of var
  • use arrow functions where appropriate
  • use updated object literal syntax (particularly for method definitions)
  • etc.

Mechanism to Configure Other Plugins

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.

Provide Ember 2.2.0 Initializer example

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

Test Helper to Initialize Service

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.

Helper Broken in Ember 1.11

In Ember 1.11, the this pointer is undefined in helpers as a result of this commit:

emberjs/ember.js@5d6353a

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.

Future of this add-on

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.

Variable replacement support for computed properties

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.

Error with Ember.js 1.13

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;

Rejected Promise in Init With Missing Locale Files

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.

Collaborate with ember-i18n / ember-cli-i18n / ember-intl?

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 ...

unable to use github version of ember-i18next, broccoli build error

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?)

Ability to use ember-i18next during integration tests

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.

  1. Is this possible?
  2. If it is possible, are there any helpers that could make this easier or at the very least maybe a little but of documentation for any users of the library.

Cheers

Ember Server failing after including ember-18next

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

Translations With Bound Parameters Display [object Object]

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

{{t "testarg" count=model.count}}

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.

Service should proxy i18next completely

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.

Upgrade Documentation

Document the upgrade to ember-i18next 2.x, including the following:

  • updating the i18next dependency
  • adding the i18next-xhr-backend dependency
  • configuration changes

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.