[Seaside] getting results back
Maarten Mostert
maarten.mostert at wanadoo.fr
Tue Aug 14 13:01:15 UTC 2007
Well this certainly gives me a result I can use
Lukas Renggli a écrit :
>> language isNil
>> ifTrue:
>> [language := '??'.
>> html
>> script: 'if (navigator.appName == "Netscape")
>> var language = navigator.language;
>> else
>> var language = navigator.browserLanguage;
>> window.location.href="'
>> , html context actionUrl asString , '&'
>> , (html callbacks registerCallback: [:v | language
>> := v]) , '=" + language'].
>> html render: language.
>>
>
> You already have it in an instance-variable called 'language'. Instead
> of rendering it on the screen you can do something else.
>
I inspected the returned object in many ways but no way to get acces to
something indicating the language their must be a stupid thing I am
missing here.
> Note that the language information is also present in the request
> header. So instead of using JavaScript I would do something more
> compilant and easy:
>
> language := self session currentRequest headers
> at: 'accept-language'
> ifAbsent: [
> self session currentRequest headers
> at: 'lang' ifAbsent: [] ]
>
> Lukas
>
>
Well this ceratinly gives me an easy to use result in my case:
'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
However if I do this in my English Opera Browser it still gives french
allthough the javascript gives English ?
Oké I haven't changed the OS language.
Rgrds,
@+Maarten,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070814/d7ba9d65/attachment.htm
More information about the seaside
mailing list