Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Using localStorage to Support Multilingual

Hi,

Thank you for trying to help me. I have removed all events and added only one event for selectmenu with the script you posted above. Now when I test the app, I am expecting when I change the option from 'English' to 'German' in selectmenu, the caption text (which is originally 'English Language') and the label text (which is originally 'This is a demo'), I expect them to show in German:
English Language : Deutsch Sprache
This is a demo: Dies ist Demo

Unfortunately, that did not happen. Nothing has changed!

Are the translation.json files correct?

en-EN: { "header":"English Language",
"This is a Demo":"This is a Demo"}
de-DE: { "header":"Deutsch Sprache",
"This is a Demo":"Dies ist Demo" }

Do I need to change anything in selectmenu properties?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Using localStorage to Support Multilingual

Hawk,

Could you please clarify, have you made all the necessary markings as in the tutorial:
http://devcenter.appery.io/tutorials/... ?
Also please specify, are there any errors in console?

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Using localStorage to Support Multilingual

Hi,

Yes, for header component, the marking is identical to the one in the tutorial. The label component, the marking is : (data-i18n : lable)

The console does not show any error/warning at all.

Are the translation.json files correct (given that the selectmenu options values are en-EN & de-DE)?

en-EN: { "header":"English Language",
"This is a Demo":"This is a Demo"}
de-DE: { "header":"Deutsch Sprache",
"This is a Demo":"Dies ist Demo" }

Do I need to change anything in selectmenu properties?
What is the significance of the identifier 't' in '$.i18n.init(option, function(t)'?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Using localStorage to Support Multilingual

Hawk,

Could you please provide us with public link to your project, we'll test: http://devcenter.appery.io/documentat...

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Using localStorage to Support Multilingual

Hi Evgene,

This is the project link

https://appery.io/app/projects/45516c...

Not sure if this is what you asked for. In order to share the project I need your email, right?

Your help is deeply appreciated

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Using localStorage to Support Multilingual

Hawk,

You have the wrong name for the folder with json files, it should be called locales (you have locals). And in the code it should be
prevar option = {lng: val, resGetPath: 'locales/lng/ns.json', fallbackLng: 'en-US'};/pre
You have inaccuracies in resGetPath.

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Using localStorage to Support Multilingual

Hi Evgene,

I have renamed the folder to 'locales' and the the code to:

var val = Appery("typeList").val();
var option = {lng: val, resGetPath: 'locales/lng/ns.json', fallbackLng: 'en-US'};//Pass the initialization language,
//set the translation files path and fallback language
$.i18n.init(option, function(t) {
$(document).i18n(); //Once the translations are loaded translate the whole document
});

It is still not showing the translation in German when I change the option in selectmenu from English to German. The console does not show any error/warning either!

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

Using localStorage to Support Multilingual

Hawk,

Sorry, there was a typo in my last reply. You should use understreck, like here:
http://devcenter.appery.io/tutorials/...

Hawk
Posts: 0
Joined: Mon Aug 04, 2014 11:23 am

Using localStorage to Support Multilingual

Thank you Evgene for all your help!

Return to “Issues”