Adding Localization [was Re: [Laszlo-dev] accept-language header required when dynamically loading dataset (for Locale)]

Adam Wolff adam at laszlosystems.com
Thu Mar 3 08:33:34 PST 2005


David,
As I suggested in my earlier post, all the browser headers should get 
sent with every request. This should enable you to respond with an 
exact or run-time modified version of your struts localization 
resource bundle (as XML.)

My group -- Laszlo Studios (Laszlo's professional services) -- has a 
component that manages the client side of this information. It's 
actually more than that -- kind of a preferences and permissions 
manager that does localization too. We have provided this to some of 
our customers as part of a consulting engagement. Someday it could be 
part of the platform, but right now it's not really productized -- it 
requires code modificiation to integrate with your app.

Adam



dhay at lexmark.com wrote:
> Hi David,
> 
> We are evaluating Laszlo for future projects, and are struggling with the
> lack of localization it provides (compare to other Web frameworks such as
> Struts, Spring MVC, Tapestry etc..).
> 
> So, we need to add that functionality if we are going to use it -
> specifically to be able to pull strings from "resource bundles" to use a
> labels, format dates etc. according to the user's browser locale (the
> current mechanism is only an eval of a possible way, obviously by far not
> the best way!  Was just interested in how to get the Locale in the
> browser...and I do believe that adding the locale to a dataset call would
> be a good thing!)
> 
> I posted a while back, offering to add it to Laszlo and add it back to the
> framework, but it didn't generate much discussion.
> 
> So, I'd like to open it up for discussion and suggestions on how to provide
> a long-term solution....
> 
> cheers,
> 
> David
> 
> 
> 
> 
> |---------+---------------------------->
> |         |           David Temkin     |
> |         |           <temkin at laszlosys|
> |         |           tems.com>        |
> |         |                            |
> |         |           03/02/2005 06:42 |
> |         |           PM               |
> |         |                            |
> |---------+---------------------------->
>   >---------------------------------------------------------------------------------------------------------------|
>   |                                                                                                               |
>   |       To:       <dhay at lexmark.com>, <hqm at alum.mit.edu>                                                        |
>   |       cc:       <laszlo-dev at openlaszlo.org>                                                                   |
>   |       Subject:  Re: [Laszlo-dev] accept-language header required when dynamically loading dataset (for Locale)|
>   >---------------------------------------------------------------------------------------------------------------|
> 
> 
> 
> 
> What is the overall goal you are trying to accomplish? Not the mechanism
> (Struts and HTTP headers), but what the app needs to do functionally in
> terms of localization. There may be a simpler way to accomplish this...
> 
> - D.
> 
> 
> 
>> From: <dhay at lexmark.com>
>> Date: Wed, 2 Mar 2005 18:02:16 -0500
>> To: <hqm at alum.mit.edu>
>> Cc: <laszlo-dev at openlaszlo.org>
>> Subject: Re: [Laszlo-dev] accept-language header required when
> dynamically
>> loading dataset (for Locale)
>>
>>
>> Hi Henry,
>>
>> Yep. that's right - if you just enter that address in your browser, the
>> Accept-Language, which indicates the user's browser language settings,
>> comes across in the headers.
>>
>> The problem is that if you are calling a servlet, for example, to create
> a
>> dataset dynamically, eg with
>>
>>         <dataset name="trans" autorequest="true" type="http"
>> src="../getDataset.do"/>
>>
>> then the Accept-Language does NOT get sent across as a header.  Hence on
>> the server-side, I can't determine what the user's language is.
>>
>> I saw something about adding a header, but I don't know how to GET the
>> language on the browser to be able to set it.
>>
>> Hope that's clearer?
>>
>> cheers.
>>
>> David
>>
>>
>>
>> |---------+---------------------------->
>> |         |           Henry Minsky     |
>> |         |           <henry.minsky at gma|
>> |         |           il.com>          |
>> |         |                            |
>> |         |           03/02/2005 05:48 |
>> |         |           PM               |
>> |         |           Please respond to|
>> |         |           hqm              |
>> |         |                            |
>> |---------+---------------------------->
>>>
> -----------------------------------------------------------------------------
> 
>>> ----------------------------------|
>>   |
>> |
>>   |       To:       "dhay at lexmark.com" <dhay at lexmark.com>
>> |
>>   |       cc:       laszlo-dev at openlaszlo.org
>> |
>>   |       Subject:  Re: [Laszlo-dev] accept-language header required when
>> dynamically    loading dataset (for     |
>>   |        Locale)
>> |
>>>
> -----------------------------------------------------------------------------
> 
>>> ----------------------------------|
>>
>>
>>
>>
>> Can you explain the issue more? I don't quite understand where you are
>> expecting locale data from? Are you trying to guess the locale of the
>> user based on some HTTP header info?
>>
>> My browser puts this info in its HTTP request headers:
>>
>> GET /lps-dev/examples/image-loading/dataimage.lzx?lzt=swf&lzr=swf6
> HTTP/1.1
>> Host: localhost:8080
>> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5)
>> Gecko/20050208 Firefox/1.0
>> Accept:
>>
> text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.
> 
>> 8,image/png,*/*;q=0.5
>>
>> Accept-Language: en-us,en;q=0.5
>> Accept-Encoding: gzip,deflate
>> Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>> Keep-Alive: 300
>> Cookie: JSESSIONID=153708F9D11FDAFDA8C137E270EC932B
>> If-Modified-Since: Wed, 02 Mar 2005 17:50:41 GMT
>> Cache-Control: max-age=0
>> Connection: keep-alive
>> Browser reload detected...
>>
>>
>>
>> On Wed, 2 Mar 2005 17:32:43 -0500, dhay at lexmark.com <dhay at lexmark.com>
>> wrote:
>>>
>>> Hi,
>>>
>>> I am trying to get around the (serious, imho!) internationalization
>> issues
>>> of Laszlo.
>>>
>>> As a first attempt, I just want to return the appropriate resource
> bundle
>>> as XML by calling a Struts action and streaming the correct one back,
>> based
>>> on the request's locale - ie request.getLocale().
>>>
>>> It turns out, however, that there is no accept-language header being
> sent
>>> with the request, no the default system Locale always appears.
>>>
>>> Any ideas if this can be added, and how?  Or workaround?
>>>
>>> thanks!
>>>
>>> David
>>>
>>> _______________________________________________
>>> Laszlo-dev mailing list
>>> Laszlo-dev at openlaszlo.org
>>> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
>>>
>>
>>
>> --
>> Henry Minsky
>> Software Architect
>>  hminsky at laszlosystems.com
>>
>>
>>
>>
>> _______________________________________________
>> Laszlo-dev mailing list
>> Laszlo-dev at openlaszlo.org
>> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev
> 
> 
> 
> 
> 
> 
> _______________________________________________
> Laszlo-dev mailing list
> Laszlo-dev at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-dev


More information about the Laszlo-dev mailing list