ngx-translate / core

The internationalization (i18n) library for Angular
MIT License
4.53k stars 579 forks source link

Merge two translation files with setTranslation #687

Open xuko opened 7 years ago

xuko commented 7 years ago

I'm submitting a ... (check one with "x")

[x] bug report => check the FAQ and search github for a similar issue or PR before submitting
[x] support request => check the FAQ and search github for a similar issue before submitting
[ ] feature request

Current behavior having this two translate files: translation1:

{
  "HOME": {
    "TITLE": "Hello Angular with ngx-translate!",
    "SELECT": "Change language"
  }
}

translation2:

{
   "HOME": {
      "TITLE": "Hello Angular with ngx-translate! version2"
    }
 }`

And doing: translate.setTranslation('en', translation2, true);

I get:

{
  "HOME": {
    "TITLE": "Hello Angular with ngx-translate!",
    "SELECT": "Change language"
  }
}

Expected/desired behavior

{
  "HOME": {
    "TITLE": "Hello Angular with ngx-translate! version2",
    "SELECT": "Change language"
  }
}

Reproduction of the problem

http://plnkr.co/edit/ur5zrnrteKPbbmGdUAEy

What is the expected behavior?

What is the motivation / use case for changing the behavior?

Merge two translation files

Please tell us about your environment:

seriana commented 5 years ago

@xuko did you manage to resolve the merge issue? I have the same problem.