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.
You can find the gettext at:
md X:\usr
md X:\usr\local
md X:\usr\local\share
xcopy {program_dir}\share X:\usr\local\share\ /s xcopy {program_dir}\bin\* {one_of_path_directory}
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.
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.
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.
msgfmt -o X:/usr/local/share/locale/{LL}/LC_MESSAGES/wget.mo {LL}.po(msgfmt.exe has been distributed in the GNU gettext package.)
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].
Copyright (c) 2000-2002, Kyosuke TOKORO<NBG01720@nifty.ne.jp> |