gettext: Locating Catalogs
1
1 11.2.3 Locating Message Catalog Files
1 -------------------------------------
1
1 Because many different languages for many different packages have to
1 be stored we need some way to add these information to file message
1 catalog files. The way usually used in Unix environments is have this
1 encoding in the file name. This is also done here. The directory name
1 given in ‘bindtextdomain’s second argument (or the default directory),
1 followed by the name of the locale, the locale category, and the domain
1 name are concatenated:
1
1 DIR_NAME/LOCALE/LC_CATEGORY/DOMAIN_NAME.mo
1
1 The default value for DIR_NAME is system specific. For the GNU
1 library, and for packages adhering to its conventions, it’s:
1 /usr/local/share/locale
1
1 LOCALE is the name of the locale category which is designated by
1 ‘LC_CATEGORY’. For ‘gettext’ and ‘dgettext’ this ‘LC_CATEGORY’ is
1 always ‘LC_MESSAGES’.(1) The name of the locale category is determined
1 through ‘setlocale (LC_CATEGORY, NULL)’. (2) When using the function
1 ‘dcgettext’, you can specify the locale category through the third
1 argument.
1
1 ---------- Footnotes ----------
1
1 (1) Some system, e.g. mingw, don’t have ‘LC_MESSAGES’. Here we use a
1 more or less arbitrary value for it, namely 1729, the smallest positive
1 integer which can be represented in two different ways as the sum of two
1 cubes.
1
1 (2) When the system does not support ‘setlocale’ its behavior in
1 setting the locale values is simulated by looking at the environment
1 variables.
1