INTERNATIONALIZATION AND LOCALIZATION OF SHELL SCRIPTS 1 - Presentation ---------------- *** Purpose, scope and intended audience *** This document is intended to help developers, maintainers and translators to write/maintain/translate internationalized then localized shell scripts, using the tools provided by GNU gettext. The reference document is the manual "GNU `gettext' utilities" @: http://www.gnu.org/software/gettext/manual/gettext.html, which I will refer to as "the manual". The manual encompasses all programming languages usable with gettext, with a special focus on the C language. The POSIX specification @: http://pubs.opengroup.org/onlinepubs/009695399/mindex.html is another useful reference, especially for definitions and shell scripting. See volumes xbd: Base Definitions and xcu: Shell and Utilities. In contrast with the the manual, the present document's scope is restricted to shell scripts. *** Theory of operation *** The aim is that messages (usually text strings) output of shell scripts be displayed on user's screen in his or her preferred language. The user indicates his or her preferences in setting the LANG or the LANGUAGE environment variable (the latter records a priorized list of languages in case there be no available translation for some of them). The internationalization (abbreviated in I18N) process consists in marking in the shell scripts that make up the software the messages to be translated, then use gettext's tools to produce from the set of marked scripts a template messages catalog, which is a human readable file with the .pot suffix (pot is an abbreviation of "Portable Object Template"). The POT file is mainly made up of the extracted text strings, preceded by "msgid" for "message identifier", each one to be followed by a translation of that message, which will be preceded by "msgstr". The localization (abbreviated in L10N) process consists in generating from the .pot a "Portable Object" or PO file (name ending in .po) for each target language (with the same structure as the POT file), translating every message in this catalog in the target language (i.e. writing the messages preceded by "msgstr"), checking these PO files after translation, then from each of them building a "Machine Objet" or MO file (machine readable only, ending in .mo), customarily stored as /usr/share/locale//LC_MESSAGES/.mo In above path, is a locale code in the form . During script's execution this allows 'gettext' to fetch the proper MO file in order to display each marked message in the preferred language as set by the LANG or LANGUAGE environment variable. Didier Spaier