« Return to Thread: i18n in new UI?

Re: i18n in new UI?

by Olivier Lamy :: Rate this Message:

| View in Thread

2012/1/23 Brett Porter <brett@...>:

>
> On 23/01/2012, at 8:04 PM, Olivier Lamy wrote:
>
>> Hello,
>> I have started some doc (really work in progress :-) ).
>> I will basically focus on provided documentation with code samples.
>>
>> Resource bundle are loaded only once when user go to the application.
>>
>> For static content some explanations can be read here
>> (http://people.apache.org/~olamy/archiva/docs/ref/1.4-M3-SNAPSHOT/archiva-web/archiva-webapp-js/template-loading.html)
>
> Ok, I think I'll need to look closer at the js webapp overall to see how it fits together.
>
>>
>> By default locale is the browser locale except if you have the query
>> parameter ?request_lang=en (due to my bad experience with selenium
>> tests which failed on my fr machine I did that to be able to force
>> locale :-) ).
>>
>> 2012/1/23 Brett Porter <brett@...>:
>>> Hi,
>>>
>>> I haven't had time to wade through all the UI changes yet, but in fixing the JDK 5 compatibility problem this morning, I saw that there is a class serving all the i18n resources over REST, which are then used in jquery.
>>>
>>> I'm curious how this architecture works? My expectation would have been that there are no localized strings in the static content (HTML/JS), and that the REST calls would return localized content as requested. Where are the keyed requests coming from?
>>>
>>> Also, how does this perform with caching and behave with allowing users to select the locale?
>>>
>>> I did notice that the call generating it is potentially quite inefficient. There are 2 calls to convert properties to a string (one for redback, which has subcalls, one for archiva), which both converted back to properties, merged and then back to a string. I'd hope the resource bundles could just be loaded once (presuming they can be updated as may be needed in an OSGi scenario later).
>>>
>> I miss you here :-).
>> There is only on rest call. I have tried to reuse redback i18n.
>> There are two properties load (one in en and an other one in the
>> request locale except if en is the default). Note it's more 2*2
>> (redback then archiva)
>
> In DefaultCommonServices.getAllI18nResources( locale ):
> - redback properties are loaded and converted to string
> - archiva properties are loaded and converted to string
> - redback string is converted back to properties
> - archiva string is converted back to properties and added to the same properties instance
> - the combined properties is converted back to a string
>
> The class just seemed very confusing - it would be better to just gather all the required properties in one instance, then write them out to the request with properties.store()?

agree I just wanted to reused redback methods but sure could (will) be
simplify :-)



--
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

 « Return to Thread: i18n in new UI?