
Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[tlug] Language localization in Javacript
- Date: Tue, 27 Sep 2011 19:31:10 +0900
- From: Martin G <ebisumartin@example.com>
- Subject: [tlug] Language localization in Javacript
TLUG,
This is probably a basic concept I'm not getting, but I'm a little
lost on how to enable localization in my Javascript code.
I can easily set up different objects containing different language
strings. Something like:
var english = new Object ();
english.l00001 = "hello";
english.l00002 = "goodbye";
var japanese = new Object ()
japanese.l00001 = "今日は";
japanese.l00002 = "サヨナラ";
(I put an "l" in front of each number because Javascript doesn't seem
to like variable names that are just numbers.)
... but I just can't think of how I switch them up at the point when I
want to display one or the other, because the switch involves changing
the name of the variable being called.
There must be a simple way to do this...?
Any advice would be much appreciated.
--
Dave M G
Home |
Main Index |
Thread Index