I have a folder with 6 different JSON files.
en.json
es.json
fr.json
it.json
ja.json
zh.json
An example of the content that is inside of each file is like the following (this case is for en.json):
{
"SomeText": "Test in English"
}
I am currently using this on my config file.
$translateProvider.translations
(
'en',
{
SomeText: 'Test in English'
}
)
.translations
(
'zh',
{
SomeText: 'Test in Chinese'
}
)
.translations
(
'it',
{
SomeText: 'Test in Italian'
}
)
.translations
(
'fr',
{
SomeText: 'Test in French'
}
)
.translations
(
'ja',
{
SomeText: 'Test in Japanese'
}
)
.translations
(
'es',
{
SomeText: 'Test in Spanish'
}
);
This last example works perfectly fine for what I want to accomplish, which is doing an initial load of english, and then if I switch languages, it will automatically refresh it.
var example = 'ja';
$translate.use(example);
However, now I want to use JSON files for a better structure, but I don't think I can use that same syntax.
How can I add all 6 files to the config and have them switched from any function like in the example above?