i18n inserts JSON access strings (keys in the translation file) instead of values

418 Views Asked by At

As opposed to this thread here my app finds the translation files when working with i18n in React. My issue is that for English & Romanian I get the JSON key (the access string) instead of the translations.

What happens is: only the German language works when selected. Also, for some reason, the german translation.json is displayed with different colors in the Preview (network tab) of Chrome's inspect console than the other languages (Romanian & English); nonetheless, these seem to be found, too (as shown in the network tab). Due to the different way Preview shows these, I am guessing this is an access problem? (check photos)

Below is how I my site looks when selecting English vs selecting German and also how I initialized i18n & how I am using it in my app, together with the json files.

Issue: enter image description here

Code: enter image description here

1

There are 1 best solutions below

0
On

I apologize! The issue was indeed with the JSON files, but not with the manner of accessing them. The problem was a few trailing commas. This is also the reason why Preview showed them differently in Chrome's inspect console.