FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Cluster Development

 
 
LinkBack Thread Tools
 
Old 12-06-2011, 02:18 PM
David Cantrell
 
Default Languages, translations, locales, timezones, keyboard layouts and the lang-table

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@redhat.com>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Westford, MA | EST5EDT

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 12-06-2011, 03:25 PM
Martin Gracik
 
Default Languages, translations, locales, timezones, keyboard layouts and the lang-table

----- Original Message -----
> Martin Gracik (mgracik@redhat.com) said:
> > 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:
>
> It's essentially the short form of the locale. But I don't think we
> use
> it for anything any more. *However*, if we're setting languages for
> the transaction/langpack plugin, we need to (for example) set both
> 'cs_CZ' and 'cs' as allowed langauges.

For this it should be enough to just have the "cs_CZ" string, and if needed expand it to "cs_CZ" and "cs", we don't need to take it from any database, right?

>
> > Another problem is the 3rd column "text mode supported". Any ideas
> > how
> > we can get rid of this information from the lang-table?
>
> Drop text mode! (You knew that was coming.)
>
> The algorithm you want to use for supporting text mode is
> essentially:
>
> - Is it a Latin or Cyrillic script -> yes
> - Otherwise -> no

How can I know if a locale is latin/cyrillic or not?

>
> In lang.sh, we explicitly blacklist ja, ko, si, zh, ar, fa, he, and
> any *_IN that isn't English, but there's probably a better way to do
> this.
>
> > 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.
>
> That's just moving it to another lookup table, though - what happnes
> if
> the s-c-keyboard code goes away?

I think you have to have a lookup table that maps locale/language to a default keyboard layout, I don't see a way of guessing it from the language name or locale. The point is that we don't need to maintain the table in anaconda. Do you know about some other tool/package that provides this language->keyboard layout mappings?

For example the territory->timezones mappings are in pytz, or it can be parsed from zonetab, but I haven't found anything similar with the keyboard layouts.

>
> Bill
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 12-07-2011, 10:02 AM
Martin Sivak
 
Default Languages, translations, locales, timezones, keyboard layouts and the lang-table

Well,

we still have to support serial consoles, but if I am not mistaken, we need only vt100 and ansi for that as the terminals do not support anything fancy. So we should be ok with latin/cyrilic defaults and english locale.

One question remains to be asked: How will we treat /set/sysconfig/keyboard in the installed system? If somebody installs minimal install and ends up in console login prompt, he should be able to type his password.. (which was created in gui with the country specific keyboard). Can s-c-kbd take care of this?

Martin

----- Original Message -----
> > Another problem is the 3rd column "text mode supported". Any ideas
> > how
> > we can get rid of this information from the lang-table?
>
> I wouldn't let this hold you up. We've already started telling
> people
> it's unlikely we'll have any kind of text mode in F17 or F18
> (whichever
> this new UI stuff first appears in), so you've got some time to
> figure
> it out.
>
> At the least, David's suggestion of keeping a list of locales that do
> not work in text mode is decent. That would only change on the very
> rare occassion that we add another language.
>
> - Chris
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list
>

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:11 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org