[fpc-devel] GetText's GetLanguageIDs()

Giuliano Colla giuliano.colla at fastwebnet.it
Sat Mar 1 13:32:39 CET 2008


Graeme Geldenhuys ha scritto:
> On 01/03/2008, Ales Katona <almindor at gmail.com> wrote:
>> Graeme Geldenhuys  wrote / napĂ­sal(a):
>>
>>  I use getText in my game and I strip anything after 2 chars since I
>>  consider only the 2 char lang codes to be valid. Depends I guess...
>>
> 
> At the moment I changed my code to strip anything from the '.' onwards
> in the first language ID returned.  That seems to fix my problem for
> now.  I can't strip anything after two characters because of
> differences in languages like: pt_BR (Brazilian Portuguese) and pt_Pt
> (Portugal Portuguese)
> 

Usually this difference is ignored in text translation. It becomes 
relevant for other issues (such as keyboard layout, date and currency 
format, etc.)

The top, for maximum flexibility wold be: if there's a full match use 
it, if not find a match with the characters up to "_". So, if you have 
fpgui.en_US.po, fpgui.en_GB.po, an user from Canada or from Australia 
(en_CA, en_AU) will still have an English translation (GB or US, the 
first found), and not a default language af_ZA or whatever.

On Linux it's easy to deal with those matters, because you may just 
create symlinks, but on Windows, if you use the full qualifier, you're 
forced to duplicate a lot of files (de_AT,de_DE,de_CH, or 
fr_FR,fr_CA,fr_CH, etc.).

Giuliano

-- 
Giuliano Colla

Whenever people agree with me, I always feel I must be wrong (O. Wilde)



More information about the fpc-devel mailing list