Hi Andun,

Unfortunately I didn't find good solution for the issue. I made some hack which 
allows to fix it right now but I think it requires other approach.
Now you could get the latest version from github and use the next code:

<script>
current_LOCALE = 'ru';
</script>
<script src="translate.js"></script>
<script src="whiteboard.js"></script>

It seems goog.getMsg approach works when locale set at  "compilation" time, but 
didn't work when locale set in runtime after compilation.
I will think on the problem and try to find better solution and will be 
gratefull if somebody has any suggestions.
Regards,
Andrey Bogdanov


Суббота, 21 сентября 2013, 22:56 +05:30 от Andun Sameera <andun...@gmail.com>:
>Hi Andrey,
>
>I tried to add your translate.js base logic to whiteboard. The thing is when I 
>add the dependency to translate.js, it gives following error.
>
>ReferenceError: goog is not defined
>[Break On This Error]     
>
>goog.provide('bay.whiteboard.translation');
>
>When I looked at your  
>https://github.com/bay73/whiteboard/blob/master/src/index_t.html 
>implementation, I found that there is a special dependency to,
>
><script src="../../closure-library/closure/goog/base.js"></script>
>
>solve the problem. AFAIK in the OM whiteboard code we cant add all these 
>Closure dependencies. So what is the resolution to this issue?
>
>Quick help will be highly appropriated since I have to finish this before day 
>after tomorrow!
>
>Thanks!
>
>
>
>
>
>On Wed, Sep 18, 2013 at 9:43 PM, Andun Sameera  < andun...@gmail.com > wrote:
>>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  < andun...@gmail.com > 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  < ba...@mail.ru > 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 < 
>>>>andun...@gmail.com >:
>>>>>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  < ba...@mail.ru > 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 < 
>>>>>>andun...@gmail.com >:
>>>>>>>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
>>
>>
>>
>> 
>
>
>-- 
>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
>
>
>
> 

-- 
Андрей Богданов

Reply via email to