Mailing List Archive
tlug.jp Mailing List tlug archive tlug Mailing List Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]Re: [tlug] Language localization in Javacript
- Date: Wed, 28 Sep 2011 16:52:10 +0900
- From: Richard Frankum <richard.frankum+mailinglist@example.com>
- Subject: Re: [tlug] Language localization in Javacript
- References: <CA+kCxRb8df237PV1ZdvOp5Emuqgz_=RdVzpa_fPMJEbQZRX3sA@example.com> <4E81AF97.2060001@example.com> <CA+kCxRaM==wbOGH4Qcs__qsPY9SEyQNH9OBefxDbHv0Y2MQ6YQ@example.com>
The colon used here is the "ternary operator", a C-style shortcut to mimic an if statement. http://en.wikipedia.org/wiki/Ternary_operation For multiple languages, you'd use a "switch" statement to set the language first. --Richard 2011/9/28 Martin G <ebisumartin@example.com>: > Darren, (and Lewske), > > Thank you for responding. > >> var x=(language=="en"?english:japanese); >> ... >> alert(x.l00001); > > This works perfectly. If I understand it, it's essentially an if/else > condition, so if language equals "en", then we use the English set, > and if not, then we get Japanese. > > However, I've never used this syntax before and I'm having a hard time > extending it. I looked up Javascript and colons on Google, but all I > saw was how it's used in JSON syntax, which doesn't seem to be how > it's used here. > > How would I set up a conditional for three or more possible languages? > I'm likely to have a dozen or more languages available for this > application. > > Any advice is much appreciated. > > -- > Dave M G > > -- > To unsubscribe from this mailing list, > please see the instructions at http://lists.tlug.jp/list.html > > The TLUG mailing list is hosted by the award-winning Internet provider > ASAHI Net. > Visit ASAHI Net's English-language Web page: http://asahi-net.jp/en/ > -- --Richard Frankum
- References:
- [tlug] Language localization in Javacript
- From: Martin G
- Re: [tlug] Language localization in Javacript
- From: Darren Cook
- Re: [tlug] Language localization in Javacript
- From: Martin G
Home | Main Index | Thread Index
- Prev by Date: Re: [tlug] Language localization in Javacript
- Next by Date: Re: [tlug] Language localization in Javacript
- Previous by thread: Re: [tlug] Language localization in Javacript
- Next by thread: Re: [tlug] Language localization in Javacript
- Index(es):
Home Page Mailing List Linux and Japan TLUG Members Links