Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Substructures and detecting if in structure and its values


ocon - 4:01 am on Oct 7, 2012 (gmt 0)


I'm trying to create structure of various words and phrases in different languages. JavaScript isn't my strong suite, but something like:

var languages = {
"en":{
"load":"Loading",
"next":"Next",
"prev":"Previous"},
es:{
"load":"Carga",
"next":"Próximo",
"prev":"Anterior"},
pt:{
"load":"Carregamento",
"next":"Próximo",
"prev":"Anterior"}};

From this, or whatever may be a more appropriate structure, what I need to do is to be able to detect if a language is in the structure and what a given word or phrase is.

language.indexOf("en");
language.indexOf("de");

selectedLang = "es";
language.selectedLang.load;
language.selectedLang.next;

I'm not sure how best to persue this and would appreciate any advice. Thanks.


Thread source:: http://www.webmasterworld.com/javascript/4504971.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com