On 12/06/2011 07:25 AM, Martin Gracik wrote:
Hi, with the UI rewrite of the language selection, I would like to get rid of the lang-table, and most of the hardcoded language specific stuff. I got code that can find out all the translations we have available for anaconda in the runtime, and also code to get all available locales, with preferred timezones, native names, etc., and I'm trying to make it work together and put it to language.py. So the 1st part is to get rid of lang-table and lang-names somehow. The 2nd part is to be able to preselect language/location/timezone to some sane defaults based on the geoip location, or language selection. So I was looking at language.py, localeinfo.py and the lang-table file, and here's a sample line from lang-table: Czech cs True cs_CZ.UTF-8 cz-lat2 Europe/Prague In my code I got "cs_CZ", "Czech" and "Europe/Prague" figured out. I also have the native language name, but some problems arise with the other columns. What is the 2nd column (short name) for? Do we need it? And if yes, is there some standard where I can get this mapping? Most of the short names are just the language name from the locale, but there are some exceptions where we also use the territory part for the short name to differentiate between the languages, for example:
The second column provides the value used to find the .po file for the chosen language. Check out loadLanguage() in lang.c. And look at the loader.tr target in loader/Makefile.am. The loader.tr file is a cpio archive containing all of the supported translations for loader, but we store the po files as LANGKEY.po where LANGKEY is the value of that second column.
If you can modify it to use any other field to store those files, we should be fine.
There is a standard for these names, just pick your favorite. :) Have a look at: http://en.wikipedia.org/wiki/Locale And the link to BCP 47. Really fun reading.
Chinese(Simplified) zh_CN False zh_CN.UTF-8 us Asia/Shanghai Chinese(Traditional) zh_TW False zh_TW.UTF-8 us Asia/Taipei or: Portuguese pt True pt_PT.UTF-8 pt-latin1 Europe/Lisbon Portuguese(Brazilian) pt_BR True pt_BR.UTF-8 br-abnt2 America/Sao_Paulo Another problem is the 3rd column "text mode supported". Any ideas how we can get rid of this information from the lang-table?
It may be easier to internally store a list of languages that text mode does not work on. I think that list is mostly static and shorter. Really, anything that doesn't use the Latin character set we should just map to English.
The last part (5th column) is the preferred keyboard layout, which I think we can get from system-config-keyboard, as we do try in language.py now. If anyone has some better ideas please let me know.
I'm all for this change, would be really nice to get rid of lang-table. Maintaining it is an art.
-- David Cantrell <dcantrell@xxxxxxxxxx> Supervisor, Installer Engineering Team Red Hat, Inc. | Westford, MA | EST5EDT _______________________________________________ Anaconda-devel-list mailing list Anaconda-devel-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/anaconda-devel-list