I am trying to use i18next to translate my app, which has some html checkboxes. here is the html code:
<p> <input type="checkbox" data-i18n= "content.body" id="CNCities" /> Beijing, Shanghai, Guangzhou... </p>
<p> <input type="checkbox" data-i18n= "content.body" id="AsiaCities"/> Beijing, Shanghai, Seoul, Tokyo... </p>
I can write json file to translate them to Chinese like this:
{
"CNCities": "北京, 上海,广州...",
"AsiaCities": "北京,上海,首尔,东京...."
}
Obviously there will be quite some of city names are duplicated in various collections. Therefore I am trying to have a json dictionary like this and make it work:
{
"Beijing": "北京",
"Shanghai": "上海",
"Seoul": "首尔"
}
So what is the proper javascript code to make it work? Or i18n is not a solution for this purpose and I have use something as gettext?