Reputation: 21620
THE SITUATION:
I am using angular-translate for my app.
Everything was working perfectly. But i just needed to move the translations into static json files.
I have followed all the instructions but is not working.
THE CODE (BEFORE):
$translateProvider.translations('en', {
"WELCOME": "Welcome",
});
$translateProvider.translations("tr", {
"WELCOME": "Hoşgeldiniz",
});
$translateProvider.translations("it", {
"WELCOME": "Benvenuto",
});
THE CODE (NOW):
$translateProvider.useStaticFilesLoader({
prefix: '/translations/',
suffix: '.json'
});
JSON FILES:
path:
www/translations/en.json
www/translations/it.json
www/translations/tr.json
Example:
{
"WELCOME": "Benvenuto",
}
ERROR:
SyntaxError: Unexpected token } in JSON at position 4160
at Object.parse (native)
THE QUESTION:
How can i load the translations from static json using angular-translate?
What can be wrong in my case?
Thank you!
Upvotes: 2
Views: 8373
Reputation: 1705
Removing char ',' at the end of key definition in your json. It make json parser try to read next char '}' as new key and error raised
Upvotes: 6