Sa
mba-JP Top Page [ News | Documentation | Project | Event | Users Group | Mailing List ]
JAPANESEENGLISH

Release note for SWAT message i18n

Oct, 6, 2000
Ryo Kawahara
rkawa@lbe.co.jp
https://www.samba.gr.jp/project/samba-ja/

Table of contents

How to add a new language

In Samba Japanese Edition we have shipped the internationalized SWAT, which can support additional languages other than pre-installed English and Japanese by adding the language information data as described later. See Technical Notes of Samba Japanese Edition to get the technical information. This page tells how to add a new language. Note that a relative path described here is used to specify the path from top directory in extracted Samba archive.

Adding the translated Samba Documentation Files

Researching the Language Information

Before setting you have to research how the language string of your language is set in Accept Language header sent by your browser. For example normally "ja" is sent to specify Japanese, but older Microsoft Internet Explorer 3.x is sent "jp" instead. There may be a language which has more than one string to specify itself other than Japanese. Usually these language codes are defined in ISO 639, but some exception exists. This string is called in this page as Browser's Language.

Adding the translated Samba Documentation Files

Put your translated HTML files which comes from docs/html and swat/help (now welcome.html only) into docs/{Browser's Language}/htmldocs and swat/{Browser's Language}/help. If a file is requested and there is no translated one, the default Browser's Language(now 'en') 's one is automatically returned. Thus if only part of files are translated, you can use this feature to put translated them. And you can also allow to put additional files for particular language with adding links in welcome.html. As SWAT works as a mini Web server, you can flexibily add the customised Web pages. For example in Japanese environment we have added files about Japanese only notes.

Adding to the install script

Add your Browser's Language to the line which starts with lang= in source/script/installswat.sh, then translated documentation files are installed automatically.

Adding to the message catalogue file

New message catalog file(.po file) needs to be created to add another language used in SWAT form messages.

Installing GNU gettext package

First you have to install tools for editing and formatting message catalog. Though there are several implementation of gettext library, we now support GNU gettext only. (This tool is only needed when you want to add a message catalog. usual SWAT users do not need it.) See the documents in GNU gettext for installation.

Adding to the message catalogue file

In the next step, copy source/po/i18n_swat.pot to source/po/{Browser's Language}.po file and edit the file with your text editor. It will be useful to use Emacs PO mode which is included in the gettext package. Translation of the string in msgid line should be written in msgstr line, except for the first entry in the file. The first entry of the message catalog has a following format.

source/po/i18n_swat.pot:line 1
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Free Software Foundation, Inc.
# FIRST AUTHOR , YEAR. <-- proper value
#
msgid ""
msgstr ""
"Project-Id-Version: i18n_swat \n"
"POT-Creation-Date: 2000-03-30 15:09+0900\n"
"PO-Revision-Date: 2000-02-08 12:48+09:00\n"
"Last-Translator: Ryo Kawahara \n" <-- proper value
"Language-Team: (sample) \n" <-- proper value
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset={Character code used by message string(such as Shift_JIS)}\n"
"Content-Transfer-Encoding: \n"
#: web/swat.c:125
#, c-format
msgid "ERROR: Can't open %s\n"
msgstr "{message strings in your Browser's language}"

(continued...) 

Note that " charset= " should be same as DOS codepage which are supported in Samba, especially in Japanese environment (i.e. if you want to add Japanese message catalog, the file should be encoded with Shift_JIS) because filenames and parameter values are encoded and displayed to SWAT in code of DOS codepage.

Add the message catalog to the Samba archive

Add your Browser's language to ALL_LINGUAS variable in the line 1947 of source/configure.in, then the file will automatically converted to .gmo file(mentioned in later section) and installed.

source/configure.in:line 1947
# gettext support.
# (added by rkawa)
PACKAGE=i18n_swat
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
AC_SUBST(PACKAGE)
ALL_LINGUAS="en ja {your Browser's language}}"
AM_GNU_GETTEXT

And run autoconf command at source/ directory to create configure script. Now we are ready to create .gmo file. Run make command at the source/ directory, then source/po/{Browser's language}.gmo is created. This file is a runtime binary data file of the message catalog, so don't forget to add this file into the Samba archive if you want to redistribute it. Installation is done with usual make install comamnd.

% cd source/
% autoconf
% make