ngx-translate-messageformat-compiler icon indicating copy to clipboard operation
ngx-translate-messageformat-compiler copied to clipboard

Nested translation JSON files

Open Gragx opened this issue 3 years ago • 1 comments

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?

Gragx avatar Apr 14 '22 19:04 Gragx

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

retoko avatar Jun 03 '22 09:06 retoko

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

lephyrus avatar Feb 03 '24 22:02 lephyrus