locales, lang menu and usages

Jean-Christophe Michel <jc.michel-/aRvmaKoZxNWk0Htik3J/[email protected]> Thu, 24 Mar 2005 10:29:03 +0100
Newsgroups gmane.comp.lib.binarycloud.devel
Message-ID <[email protected]>
Hi,

After a discussion with Manuel yesterday, I'll try to make a summary of 
locales problem and the usage that can be done with langs, couontries 
and currencies.

Context
* I'm updating vortex/langmenu, that displays a menu to change current 
lang, and BC_LANG, BC_LANGUAGES have to be replaced by info grabbed from 
Locale class.

Axiom
* lang and countries are not necessarily linked during navigation:
  - you want to choose your lang as soon as you come on a site; choosing 
a country is useful only if you want to order, subscribe,...
  - you can browse in a lang that's not linked to a country in supported 
Locales list: imagine you're a Hungarian travelling in Canada, it's 
likely the website you'll use won't have a 'hr_CA' locale, whereas it's 
possible that 'hr' lang can be supported and 'CA' country too.

(see http://www.ibm.com/planetwide/select/selector.html for a locale 
selector, such list is probably only convenient for i18n specialists, 
most common users will be feared by such a list :-)

  -> I conclude from this that lang and country doesn't have the same 
usage. Locale concept group them because it's logical from the Locale's 
point of view. Lang will change the text printed. Country would change 
prices (shipment, price policy), distributor list, product 
availability... They don't need to be chosen together.

As in java Locale http://jan.netcomp.monash.edu.au/i18n/locale/locale.html
I think that i18N and Locale classes should be used as a 'locale 
server', but keep lang and country as independant values.


Proposed changes
* current lang and country should be stored into User class and not 
directly in session
* on startup, User is restored from session; if no lang, it's negociated 
if possible, else default site lang is used; if no country, if not 
obtained from negociation, take the default one for the lang.
* add getDefaultLang() and getAvailableLangs() to I18n class, that will 
simply take first two chars of i18n.conf values
* when chosen lang/country is not available, translation or format tries 
to use default lang/country instead (ehancement: use Negociation to 
learn what choices are set in Client, and follow Client list of locales 
to find a default lang/country to replace missing ressource). It's 
important to have this mechanism when a site is only partially translated.
* Client should keep a list of preferred locales (AcceptLanguages)

* LangMenu should still use only langs and not locales.

-- 
Jean-Christophe Michel

_______________________________________________
dev mailing list
dev-PnctHDZWAvB/Cz2I37pSEPZ4XP/[email protected]
http://lists.binarycloud.com/mailman/listinfo/dev