When writing programs what is the correct environment variable to look at to decide upon the displayed menu and dialog language?

Experiments with qtikz showed me that LC_ALL is respected (overrides all other LC_-variables). But as soon as I have

LC_NUMERIC=en_US.UTF-8

qtikz display its menues in english. Which I find rather peculiar. But I do not consider one Qt-program to be authoritative in that respect.

I expected LANG to have some influence:

This variable shall determine the locale category for native language, local customs, and coded character set in the absence of the LC_ALL and other LC_* ( LC_COLLATE , LC_CTYPE , LC_MESSAGES , LC_MONETARY , LC_NUMERIC , LC_TIME ) environment variables. This can be used by applications to determine the language to use for error messages and instructions, collating sequences, date formats, and so on.

Does "This can be used" mean, that LANG should be chosen to set the display language, or that "this variables" can be used for that? My first guess was, that LC_MESSAGES sets the menues and dialogs, but not in my experiments.

Or is there a different approach, involving environment-variables, presumably?

有帮助吗?

解决方案

LC_ALL takes precedence over LC_... for the suitable category, which in turn takes precedence over LANG. From your link:

LANG
This variable shall determine the locale category for native language, local customs, and coded character set in the absence of the LC_ALL and other LC_* ( LC_COLLATE , LC_CTYPE , LC_MESSAGES , LC_MONETARY , LC_NUMERIC , LC_TIME ) environment variables. This can be used by applications to determine the language to use for error messages and instructions, collating sequences, date formats, and so on.

So LANG is used as a last resort only. Regarding LC_MESSAGES:

LC_MESSAGES
This variable shall determine the locale category for processing affirmative and negative responses and the language and cultural conventions in which messages should be written. [...] Additional semantics of this variable, if any, are implementation-defined.

Since dialogs and menu texts are program messages, they should be affected by LC_MESSAGES category, unless LC_ALL is set.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top