PDA

View Full Version : Languages, having problems.



jorgeluislay
17 Dec 2012, 3:27 AM
Hello there!

I am having some issues with the setting of more languages. How can i do this ?

(Not asking for syntax, more asking for architektur)


1) index.html
combobox whit three languages:
var language= "en"; //i choose english


2) ApplicationLanguages.js

Ext.ns("ApplicationLanguages.lang");
myApp.lang.en{
title01: "Hello there",
key02: "value02"
};

myApp.lang.de{
title01: "Hallo wie gehts",
key02: value02
};

myApp.lang.es{
title01: "Como estas ?",
key02: value02
};


So this, works fine:

MyGrid = Grid {(
title: myApp.lang.en.title01,
...
)};



When i change this to spanish or german, it remains english so i changed it to this:

MyGrid = Grid {(
title: myApp.lang. + language + .title01,
...
)};

syntax error. so next change without dots and:

var language = ".en."

MyGrid = Grid {(
title: myApp.lang + language + title01,
...
)};

So here i dont get any syntax errors but it doesnt get dynamically what i want it to do. Of course is language a String and does not work getting the json class what i need. but i dont know how to do it.

Any help please ? :s

jorgeluislay
18 Dec 2012, 10:12 AM
any help on this ?

i think it is ok to know about some search words, that i can be looking in google!

willigogs
20 Dec 2012, 6:45 PM
I wouldn't include all language strings in one file - since this means the user is downloading and populating numerous variables which will never be used (i.e. If English is selected, the German, Spanish, French, etc variables are never needed).

Instead, I would have a separate language string file for each language, which all contain the exact same variables - then simply load the correct version of this file depending on which language they have selected?

An example:
http://dev.sencha.com/deploy/ext-3.4.0/examples/locale/multi-lang.html

wm003
4 Jan 2013, 1:12 PM
You should try


title: myApp.lang[language].title01,