Good explanation. Could you add that information to Faq or somewhere.
I am sure, there are more people who would like to know, how locale
thing works ?


--
Raido




On Mon, Apr 19, 2010 at 5:26 PM, Scott Wilson
<[email protected]> wrote:
>
> On 19 Apr 2010, at 14:52, Raido Kuli wrote:
>
>> Hi.
>>
>> Is there any kind of auto detection also ?
>
> Yes! See below...
>
>>
>> I did some testing.
>>
>> I added new locale "et" to local.widgetserver.properties. Default
>> locale by local.widgetserver.properties is "en". I do not pass locale
>> parameter to widgetinstances request.
>>
>> And some how my widget is displayed in local language.
>>
>> Then i tried changing locale folder name, like to "au" or something
>> random. Then i got default english index.htm of my widget.
>>
>> So does Wookie detect local system locale or some how via browser ?
>
> The way it works is that for each resource requested, Wookie checks which 
> localized versions are available, and then selects them in order of preferred 
> locales for the widget instance. If there are no preferred locales set, then 
> Wookie asks ICU4J GlobalizationPreferences.getLocales() for the default list 
> of locale priorities. I presume it collects these from system info somehow.
>
> So if you have
>
> /index.html
> /locales/et/index.html
>
> Asking for index.html for a widget instance with preferred locale "et", or 
> with no preferred locale on a server in Estonia, should return 
> /locales/et/index.html
>
> Asking for index.html for a widget instance with no preferred locale in a 
> server running anywhere other than Estonia., or with any preferred locale 
> other than "et",  should return /index.html
>
> (This does raise the question of what the default locale setting in 
> widgetserver.properties is supposed to do. Is it actually used anywhere?)
>
> This is all handled in the LocalizationUtils class in the Wookie parser:
>
> http://svn.apache.org/repos/asf/incubator/wookie/trunk/parser/java/src/org/apache/wookie/w3c/util/LocalizationUtils.java
>
> S
>
>>
>>
>> --
>> Raido
>>
>>
>>
>>
>> On Fri, Apr 16, 2010 at 7:22 PM, Raido Kuli <[email protected]> wrote:
>>> Yes I can, I'll do it later.
>>>
>>> On Fri, Apr 16, 2010 at 7:20 PM, Scott Wilson
>>> <[email protected]> wrote:
>>>> On 16 Apr 2010, at 17:02, Raido Kuli wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>>>
>>>>>> Note that I don't think subsequent requests for the *same* widget 
>>>>>> instance with a different locale parameter will do anything.
>>>>>>
>>>>>
>>>>> Yes that's true, I finally removed my widget from wookie  and added
>>>>> again. After that i was able to create new instance with locale i had
>>>>> specified by parameter "locale"; Obviously just by updating the widget
>>>>> it didn't detect my new locales.
>>>>>
>>>>> Currently if widget instance was created for user "joe" with locale
>>>>> "ru" and then "joe" wants to use "en" instead then it can't be done.
>>>>> Is there any way how to change locale for current instance ?? For
>>>>> example I have some sort of website, it has language buttons "en",
>>>>> "et", "ru" and i always initialize widget with username "anonymous".
>>>>
>>>>> When picking the language, it should change widgets locale to, if
>>>>> widget has one.
>>>>
>>>> I'm sure it can be done, I think its just a case for putting in a check 
>>>> for changes to locale when handling widget instance requests - can you 
>>>> make a new issue for it?
>>>>
>>>>> It's not possible to change widget username all the time, because
>>>>> widget preferences will be then lost.
>>>>>
>>>>> One last option, is to implement some sort of Javascript based
>>>>> language helper, but i'd rather to it W3C way.
>>>>>
>>>>> --
>>>>> Raido
>>>>
>>>>
>>>
>
>

Reply via email to