gettext unit looks for the wrong files
Original Reporter info from Mantis: pgimeno
-
Reporter name: Pedro Gimeno
Original Reporter info from Mantis: pgimeno
- Reporter name: Pedro Gimeno
Description:
If I have my LANG variable set to es_ES.UTF-8, gettext looks for projectname.es_ES.UTF-8.po, using projectname.es.po as a fallback. It should not use the encoding part of the language.
If it's set to es, it looks for projectname.es.po and does not use any fallback, regardless of the contents of the LANGUAGE environment variable.
If LANG is set to C, gettext looks for projectname.C.po, and uses that for translation if it exists.
That behaviour is not the expected one for programs that use the standard i18n/l10n environment variables. This section, and the three pages it contains, documents how the search should proceed:
In summary:
&LtPos;ol>
&LtPos;li>If LANG is C, do not translate anything.&LtPos;/li>
&LtPos;li>Otherwise, if LANGUAGE is set, use each of its entries (separated by ':') in preference order.&LtPos;/li>
&LtPos;li>Otherwise, if LC_ALL is set, use it.&LtPos;/li>
&LtPos;li>Otherwise, if LC_MESSAGES is set, use it.&LtPos;/li>
&LtPos;li>Otherwise, use LANG if set.&LtPos;/li>
&LtPos;/ol>
Use the resulting string only up to and not including the first dot (or the whole string if there's no dot).
I'd suggest to do this in addition:
&LtPos;ul>
&LtPos;li>The function to find the locale ID should return a list of preferred ids, in order from most to least preferred (e.g. as a TStringDynArray).&LtPos;/li>
&LtPos;li>If the two-letter language ID for each of the languages listed (the first two letters of the locale ID) is not present in the list, include it immediately after the last appearance of that language.
&LtPos;/ul>
Mantis conversion info:
- Mantis ID: 37936
- OS: Linux
- Build: 47066
- Platform: x86_64, compiler build 47066
- Version: 3.3.1