Ember-intl: Merge translations

Created on 17 Apr 2018  路  3Comments  路  Source: ember-intl/ember-intl

I find myself in a case where I want to dynamically override some translations value based on some criteria.
I thought I could do this by asynchronously loading the new translations parts and then call intl.addTranslations(), but instead of overriding and merging the incoming parts it redefines the whole translation object.

For example, in the base translation file, I have

'key': {
    'sub-key-one' : 'some_value_one',
    'sub-key-two' : 'some_value_two'
} 

and wanted to override with:

'key': {
    'sub-key-one' : 'some_new_value_one',
}

Does that make sense ?

enhancement

Most helpful comment

@sly7-7 this is now part of 3.0.0-beta.3. Be mindful of the breaking changes within 3.0.0.

https://github.com/ember-intl/ember-intl/commits/master

I will include a migration document before I release stable.

All 3 comments

You're after doing a deep merge between the translations being added and existing translations. I think we can support this. Happy to review a PR or will work on it in the coming weeks (lots of my plate at the moment).

I'll start on this soon, will be included in the 3.0.0-beta tag (master).

@sly7-7 this is now part of 3.0.0-beta.3. Be mindful of the breaking changes within 3.0.0.

https://github.com/ember-intl/ember-intl/commits/master

I will include a migration document before I release stable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gossi picture gossi  路  5Comments

UzEE picture UzEE  路  8Comments

szneba picture szneba  路  5Comments

nightire picture nightire  路  9Comments

sbsurf picture sbsurf  路  7Comments