Ticket #3882 (closed defect: invalid)
Forcing mc language together with codepage no longer works
Reported by: | pbodnar | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | mc-core | Version: | 4.8.11 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Branch state: | no branch | Votes for changeset: |
Description
Note: Maybe this somehow relates to reported defect #3809, but it is really hard to tell from user's perspective.
Being on Ubuntu 14.04, recently upgraded from 12.04, mc probably upgraded as well - to version 4.8.11. Since then, the "trick" with setting the LANG system variable as described at SO works only partially since then:
a) running "LANG=C.UTF-8 mc -V" (or "LANG=en_US.utf8 mc -V") outputs:
GNU Midnight Commander 4.8.11 Sestaveno s GLib 2.39.1 Používá se knihovna S-Lang s databází terminfo S vestavěným editorem Se standardní podporou podshellu S podporou operací na pozadí S podporou myši v konzolích Xterm a Linux S podporou X11 událostí S podporou internacionalizace S podporou více kódových stránek Virtuální souborové systémy: cpiofs, tarfs, sfs, extfs, ext2undelfs, ftpfs, sftpfs, fish Typy dat: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;
But expected: output will be in English, not in system's default language.
b) running "LANG=C mc -V" outputs:
GNU Midnight Commander 4.8.11 Built with GLib 2.39.1 Using the S-Lang library with terminfo database With builtin Editor With subshell support as default With support for background operations With mouse support on xterm and Linux console With support for X11 events With internationalization support With multiple codepages support Virtual File Systems: cpiofs, tarfs, sfs, extfs, ext2undelfs, ftpfs, sftpfs, fish Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;
This is correct, but logically results in having incorrect codepage used (some "ANSI_X3.4-1968", as output by mvn -version if one has an unrelated tool - Maven - installed).
Also checked that all locales used in the examples are available (via locale -a).
This defect forces me to use the Czech translation (system default) of the mc until resolved...
Change History
comment:1 Changed 7 years ago by pbodnar
- Summary changed from Forcing language together with codepage no longer works to Forcing mc language together with codepage no longer works
comment:2 Changed 7 years ago by andrew_b
- Status changed from new to closed
- Resolution set to invalid
- Milestone Future Releases deleted
Current mc is 4.8.20. Please test it and feel free to reopen this ticket if bug is still actual.
comment:3 Changed 7 years ago by egmont
According to https://www.gnu.org/software/gettext/manual/gettext.html#Locale-Environment-Variables, the gettext system uses four environment variables to determine the language. In decreasing order of preference:
- LANGUAGE
- LC_ALL
- LC_MESSAGES
- LANG
That is, you are modifying the weakest of these four.
I don't understand why LANG=C.UTF-8 gives you Czech messages whereas LANG=C gives you English ones. But in order to further investigate, we'd need to:
- as andrew_b also pointed out, try with a current mc rather than a 4 year old one,
- see all your relevant environment variables,
- see whether mc is the odd one here, or all gettext applications behave the same way.
Probably the solution to your particular request is as easy as to set LANGUAGE=en.
comment:4 Changed 7 years ago by egmont
A bit further down in the document I linked it says:
Note: The variable LANGUAGE is ignored if the locale is set to ‘C’.
This totally explains the behavior you're encountering (Czech with C.UTF-8, English with C), and now I'm also pretty sure you have LANGUAGE=cs (or cs_CZ) defined.
[On a side note: C.UTF-8 is added in a custom patch by a couple of distributions, including Debian and Ubuntu, but is not part of official glibc and is not available universally across all Linux systems.]
comment:5 Changed 7 years ago by pbodnar
Hi,
thanks a lot for your useful and quick feedback, problem solved :)
I also tested with the latest 4.8.16 version available for Ubuntu 14.04 and the behavior is very much the same.
You are correct that simply setting LANGUAGE=en is just enough and that I had LANGUAGE=cs_CZ set by some system program probably. So I'm only wondering if you could point to me a documentation of MC where at the least the link to the getttext documentation is supplied?
---
A bit further down in the document I linked it says:
Note: The variable LANGUAGE is ignored if the locale is set to ‘C’.
True. Moreover, when one specifies an invalid LANG (i. e. locale), it seems to fallback to the ‘C’.