How to use the locale support

Kyosuke Tokoro
Last updated: 17 Nov. 2000
Back to my OS/2 file library

I have ported some software packages to the OS/2 from the unix. Two of them support i18n (the word "i18n" means "internationalization") with calling the GNU gettext 0.10.35 library. One is GNU wget 1.5.3-3 and another one is GNU grep 2.4.

After distributed them, some people have asked me that "how to use the locale support?" Okay, I'll show you how to do it.

Typical steps to install the wget and/or the grep

  1. Download and unpack GNU gettext 0.10.35 ported by Hung-Chi Chu, and copy intl.dll to somewhere on your LIBPATH.

    You can find the gettext at:

  2. md X:\usr
    md X:\usr\local
    md X:\usr\local\share

  3. unpack or, and:
        xcopy {program_dir}\share X:\usr\local\share\ /s
        xcopy {program_dir}\bin\* {one_of_path_directory}
  4. Set your language code and country code as the LANG environment value. For example, if you want support Japanese:
        set GNULOCALEDIR=X:/usr/local/share/locale
        set LANG=ja_JP

    First two-letter of the LANG environment value is language code (ISO 639.) And last two-letter of this value is country code (ISO 3166.)

    Language codes are as follows:

    Chinese 'zh', Czech 'cs', Danish 'da', Dutch 'nl', English 'en', Esperanto 'eo', Finnish 'fi', French 'fr', German 'de', Hungarian 'hu', Irish 'ga', Italian 'it', Indonesian 'id', Japanese 'ja', Korean 'ko', Latin 'la', Norwegian 'no', Persian 'fa', Polish 'pl', Portuguese 'pt', Russian 'ru', Slovenian 'sl', Spanish 'es', Swedish 'sv', and Turkish 'tr'.

    GNU gettext requires only the language code. But some other programs require both of them. For more information about setting for LANG environment variable, see "Command Reference (CMDREF.INF)" and search "LANG", "system locale" or something like these.

    Type "wget" or "grep," and you will get a message from the wget/grep in your language. If you don't get a message in your language, something is wrong, or your language has not been supported by the wget/grep yet.

  5. If above steps are okay, add following lines to your config.sys:
        set GNULOCALEDIR=X:/usr/local/share/locale
        set LANG={your language}_{your country}

    A "set LANG={your language}_{your country}" statement may be already in config.sys. If it is, you must add only a "set GNULOCALEDIR={somewhere}" statement for the GNU gettext.

How to edit the messages

With above settings, I hope the wget and/or the grep speak your language very well. But I can speak only Japanese and I have not tested them only in Japanese. If the wget and/or the grep cannot speak your language well, you can edit the message(s) with following steps.

  1. Get the source package from or one of its mirrors.
  2. Unpack it.
  3. In the "{program-version}/po/" directory, there will be many "{LL}.po" files, where {LL} gives an ISO 639 two-letter code identifying the language. For example, to change Czech messages, edit "cs.po" file.
  4. After editing it, type:
        msgfmt -o X:/usr/local/share/locale/{LL}/LC_MESSAGES/ {LL}.po
    (msgfmt.exe has been distributed in the GNU gettext package.)

The LANGUAGE environment variable

I have found following information in the document that was named ABOUT-NLS.

An operating system might already offer message localization for many of its programs, while other programs have been installed locally with the full capabilities of GNU 'gettext'. Just using 'gettext' extended syntax for 'LANG' would break proper localization of already available operating system programs. In this case, users should set both 'LANGUAGE' and 'LANG' variables in their environment, as programs using GNU 'gettext' give preference to 'LANGUAGE'. For example, some Swedish users would rather read translations in German than English for when Swedish is not available. This is easily accomplished by setting 'LANGUAGE' to 'sv:de' while leaving 'LANG' to 'sv'[*1].

On the OS/2 systems, the LANG setting must be "sv_SE", if you want to use the Swedish language support.)

Related links

· How to install OS/2 applications (This is written in Japanese)
· GNU gettext utilities
· GNU gettext ported for OS/2 by Hung-Chi Chu
or their mirrors.
· Translation Project

Copyright (c) 2000-2002, Kyosuke TOKORO