View Issue Details

IDProjectCategoryView StatusLast Update
0037936FPCFCLpublic2020-10-17 12:43
ReporterPedro Gimeno Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Platformx86_64, compiler build 47066OSLinux 
Product Version3.3.1 
Summary0037936: gettext unit looks for the wrong files
DescriptionIf 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:

https://www.gnu.org/software/gettext/manual/html_node/Setting-the-POSIX-Locale.html#Setting-the-POSIX-Locale

In summary:

  1. If LANG is C, do not translate anything.

  2. Otherwise, if LANGUAGE is set, use each of its entries (separated by ':') in preference order.

  3. Otherwise, if LC_ALL is set, use it.

  4. Otherwise, if LC_MESSAGES is set, use it.

  5. Otherwise, use LANG if set.



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:


  • 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).

  • 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.

TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0037937 new Lazarus Translations use the wrong files 

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2020-10-17 00:17 Pedro Gimeno New Issue
2020-10-17 12:43 Bart Broersma Relationship added related to 0037937