Hi T.
this should be the last post in this thread, just to end the "discussion" here.
;)
1) With "this Method" I meant the one that I provided. That _is_ a setter.
2) There _is_ a "guess" in the name ;) It was called "guessSetLocale"
3) The whole purpose of my method was:
1. Get the setting from the client browser
2. Check whether we support that language, else we fall back to "en"
3. Make the locale known to qooxdoo
The complete use-case for this method (guessSetLocale) is something like this:
a) There is a user (Peter) that has set his application-settings language to
"de".
b) He is currently in China and browses to the login page.
c) Here our method takes over: We don't know what language we should present
our login screen 'cause we don't have user information (yet). So let's see
what the browser says..."cn". Chinese! Hmm it's not in our list (neither
"de" nor "en" nor "fr"...), so switch back to "en" which is the default.
d) Now let the qooxdoo framework know our decision
(via "qx.locale.Manager.getInstance().setLocale(locale)")
and render the login screen!
e) After Peter has logged in, we can switch to "de" (based on rock-solid
information of his user-settings. So, no more guessing than).
This means of cause, that after we got that "real" information,
a call to "qx.locale.Manager.getInstance().setLocale(realLocale)" is needed
again to let the qooxdoo-framework know!
In a Internet-Cafe in France however he might have been presented a French
login-screen.
No offense, just a rectification, ;)
Cheers, and keep up the good work
Peter
On thron7 wrote:
>>> qx.locale.Manager.getInstance().getLocale() is the better API here.
>
>> Hi T,
>> Sorry, but that's wrong! ;)
>>
>> This method should set the locale based on the client-browser setting!
>
> This method doesn't set anything, it is a getter.
>
>> This method is intended to "guess" (hence the name) the most probable
>
> There is no "guess" in the name!?
>
>> locale-setting that the user might like _before_ we have user-specific
>> information (e.g. before login)
>
> Maybe what you mean is it returns the default locale, which is usually the
> locale of the browser.
>
>> And by the way, if we would use your call, this method would just be a
>> "mgr.setLocale(mgr.getLoocale())" ...senseless, eh?
>
> You're probably mixin up .getLocale() with .setLocale.
>
> T.
>
>
>
>> /Peter
>>
>>>> // Client locale not supported?
>>>> if (!qx.lang.Array.contains(["de", "en", "fr"], locale)) {
>>>> locale = "en"; // ...fall back to 'en' (default)
>>>> }
>>>>
>>>> qx.locale.Manager.getInstance().setLocale(locale);
>>>> },
>>>> </code>
>>>>
>>>> /Peter
>>>>
>>>> On 2010-09-07 12:57 Stefan Andersson wrote:
>>>>> Does anyone have a good solution to set the language of an application
>>>>> before the main is run, such that it is possible to retrieve this from
>>>>> the HTML site's information?
>>>>>
>>>>> I am using a CMS which decides the language and it must tell qooxdoo
>>>>> what language version to use in HTML text or in any other way.
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel