Here is another suggestion which came from Closure forum. "In Chrome apps and extensions, localization is done at runtime using chrome.i18n.getMessage() -- you pass it a message id and Chrome pulls the correct translation from the messages.json file for the user's current locale. http://developer.chrome.com/apps/i18n.html has all the details.
I assume you're not writing a Chrome extension, but I bring it up because we added pass to the JS compiler, which is activated by the --replace_messages_with_ chrome_i18n flag, to replace goog.getMsg() calls with chrome.i18n.getMessage() calls. You could probably hack together another compiler pass to do something similar, along the lines of what Ilia Mirkin suggested, if you were in the mood to hack on the Closure Compiler. I'm not sure if there are any good "How to write a new pass for the Closure Compiler" tutorials around, but hopefully you can find one or just follow the example of the existing ones." I am looking in to feasible solution! Comment needed to find a good approach! Thanks! On Fri, Sep 6, 2013 at 11:56 AM, Andun Sameera <[email protected]> wrote: > I got your point! We can add these kind of arrays to add many languages. > But in OM we are using files to give the localized words like this. Using > keys to load values, > > <input type="submit" value="" wicket:id="ajax-cancel-button" > wicket:ommessage="title:157" /> > > I think Maxim can give me a clue to load suitable values from those file > to this javascript arrays( > https://github.com/bay73/whiteboard/blob/master/src/translate.js)! > > Thanks! > > > On Fri, Sep 6, 2013 at 11:43 AM, Bogdanov Andrey <[email protected]> wrote: > >> Yes, you are righ - documentation about this topic is very poor. >> >> Now I've made some translation to Russian - you could see translate.js >> script which I've commited to the https://github.com/bay73/whiteboard.git >> . >> This is simple dictionary - any language could be added there. >> >> Now I could set locale like this: >> >> <script> >> goog.LOCALE = 'ru'; >> </script> >> <script src="translate.js"></script> >> <script src="whiteboard.js"></script> >> >> Regards, >> Andrey Bogdanov >> >> >> Пятница, 6 сентября 2013, 0:49 +05:30 от Andun Sameera < >> [email protected]>: >> >> I tried to find some material related to localization. But finding >> help for Closure is a tough task. Cant we use a normal Javascript way to >> handle run-time change of languages? >> >> >> On Thu, Sep 5, 2013 at 6:19 PM, Bogdanov Andrey >> <[email protected]<https://e.mail.ru/sentmsg?mailto=mailto%[email protected]> >> > wrote: >> >> Hi Andun, >> >> I've push a version which allows to clear background. >> You could call board.setBackground() or board.setBackground('') - it >> will work >> >> Also I've surrounded all nessages with goog.getMsg call, so we could add >> internationalization. >> >> Regards, >> Andrey >> >> >> >> >> Среда, 4 сентября 2013, 22:51 +05:30 от Andun Sameera >> <[email protected]<https://e.mail.ru/sentmsg?mailto=mailto%[email protected]> >> >: >> >> I have re-factored the code and committed. Also I have added undo for >> DOC >> addition, page navigation. Also there is another small problem which >> Andrey >> can answer me. How can we go to a empty background from? I tired to set a >> "" as the url. But didn't work. >> >> Thanks! >> >> >> >> >> >> >> >> -- >> Regards >> Andun S.L. Gunawardana >> Undergraduate >> Department of Computer Science And Engineering >> University of Moratuwa >> Sri Lanka >> >> Blog - http://www.insightforfuture.blogspot.com/ >> LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 >> Twitter -http://twitter.com/AndunSLG >> >> >> >> >> >> >> >> -- >> Андрей Богданов >> > > > > -- > Regards > Andun S.L. Gunawardana > Undergraduate > Department of Computer Science And Engineering > University of Moratuwa > Sri Lanka > > Blog - http://www.insightforfuture.blogspot.com/ > LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 > Twitter -http://twitter.com/AndunSLG > > > > > -- Regards Andun S.L. Gunawardana Undergraduate Department of Computer Science And Engineering University of Moratuwa Sri Lanka Blog - http://www.insightforfuture.blogspot.com/ LinkedIn - http://www.linkedin.com/pub/andun-s-l-gunawardana/34/646/703 Twitter -http://twitter.com/AndunSLG
