On Mon, Dec 12, 2016 at 01:58:12PM +0200, Martin T wrote: > 1) pam_env.so sets the environmental variables seen in the output of > locale command based on configuration files(for example > /etc/default/locale) when user logs in
Maybe, maybe not. The LC_* and LANG variables can come from many different places. I think, however, that you are focusing on the libc/application level that uses these variables, and not their origin. So for your purposes, "LC_* and LANG are set somehow". > 2) nl_langinfo(), setlocale() and (some) other glibc functions used in > programs ask environment variables seen in the output of locale > command > > 3) based on those environment variables nl_langinfo(), setlocale(), > etc functions check the locale information in > /usr/lib/locale/locale-archive database and change their output > accordingly > > 4) /usr/lib/locale/locale-archive database is generated with > locale-gen utility based on entries in /etc/locale.gen file and locale > template/configuration files in /usr/share/i18n/locales/ > > Did I understand this correctly? I am confused. There are basically three interaction points between you and the locale system, and you don't seem to have focused on any of them. 1) LC_* and LANG are set somehow by the end user or by the local OS. 2) The local system admin runs "dpkg-reconfigure locales" to determine which locales are "generated". End users can only receive translations from locales that are generated on the local system. 3) Applications are written with localization (l10n) support using the features of whichever language they're written in, e.g. _("..."). For a more detailed look at #1, see https://wiki.debian.org/Locale (And even that is woefully incomplete thanks to the proliferation of Desktop Environments, and the ridiculous inadequacy of the PAM environment variable system.) For a more detailed look at #3, see https://www.gnu.org/software/gettext/manual/gettext.html