lephyrus / ngx-translate-messageformat-compiler

Advanced pluralization (and more) for ngx-translate, using standard ICU syntax which is compiled with the help of messageformat.js.
MIT License
93 stars 29 forks source link

Nested translation JSON files #84

Closed Gragx closed 7 months ago

Gragx commented 2 years ago

Hey there

ngx-translate allows for nested translation json files. For example something like this:

{
  "food": {
    "pizza": "Pizza"
  }
}

I would then reference pizza by the key "food.pizza".

However with ngx-translate-messageformat-compiler I get an exception when attempting to load such a nested translation file: Expected identifier but "{" found.

Is there any way to get a nested translation json to work?

retoko commented 2 years ago

Hi! I was getting the same error, but using nested translation is not the cause of this error. In my case convert all double braces {{}} to single braces {} solved this problem. See more https://github.com/lephyrus/ngx-translate-messageformat-compiler/issues/45

lephyrus commented 7 months ago

Yes, using nested translations should not be a problem. Otherwise please re-open with a minimal (but complete) reproduction, for example on StackBlitz (fork the example at the top of the README).