Re: Running language, again...



Am Freitag, den 19.06.2009, 16:12 +0200 schrieb Sever P A:

> I need to elaborate a list of languages supported (strings like
> "spanish", "english",...) by the environtment (so, the available
> ones), while GDM, for example, cannot pemits log in in a different
> language that of those set by a locale-gen process.

The available ones *are* those which have locales generated for them.
Or are you writing a system tool that can install language packs?  You
might want to look at how the Ubuntu language selector does it, then.

In either case, you've hit on a hard problem.  I don't think there is an
even remotely portable way to do that sort of thing.  You will be lucky
already if it works across different Linux distributions.

> After this list gotten, I'd like to know the environment language, and
> then, if it's possible, to get all this list according the current
> language...

Since I think GDM does what you want, I had a look at the GDM source and
found this:

http://git.gnome.org/cgit/gdm/tree/gui/simple-greeter/gdm-languages.c

To me, this looks like a thorough attempt to provide this sort of
functionality in a generic manner.  From what I can see, it does *not*
hard-code the list of languages but gets them from the system.  It also
appears to translate the language names to the currently selected local
language by accessing a special locale name.

It is quite likely that this code relies on features only available on
the modern Linux desktop.  But given the reality constraints, it looks a
solid piece of work worth building upon.

> For example,
> 
> In a system in that only has generated the four English, Spanish,
> French and Italian locales...
> 
> The appropiate list for an english environment, would be,
> ("English", "Spanish", "French", "Italian")

So you want to list only languages with available locales, after all.
Isn't this just what GDM does?

--Daniel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]