SWAT i18n feature

TAKAHASHI Motonobu monyo at home.monyo.com
Sun Sep 7 15:39:23 GMT 2003


I will fix SWAT i18n feature before shipping. 
This is now existing in the code but is not maintained because of 
my negligence.

Current status is:

1) d_printf() works well. This means we do not need to modify
   "functional" codes except BUG#412.

2) There are some wrong d_printf() calls.

3) msg files are not followed after the current codes. They must be

4) msg files are not installed during "make install" into $libdir.

5) There are no documents about this feature.

To fix 2) and 3), I think the following works are needed. 

** I will create a patch for 2) and 3a) in this week. This will change
   some places of source code but will not change the functional
   codes. So I wish to commit this patch before shipping. **

** And will do 5) before shipping. **

About 2), for example swat.c:1180

   d_printf(_("Attempting to delete these printers from SWAT
   will have no effect.\n"));

  The '\' cannot be included in the messege string. So this d_printf()
  calls are not functional. There are some calls like this. They
  *should* be fixed to modify the d_printf() itself or to modify the
  messege strings.

About 3)
  To update the msg files, we have to know which strings should be
  included in the msg files. But currently we have to look at source
  codes and update msg files by hand. So we need the way to update msg
  files automatically.

  3a) pick up the replaceable strings

  Currently most of replaceable strings which should be included in
  msg files are marked: _() or N_(). but for example swat.c:575:
    d_printf("<H2>Wizard Parameter Edit Page</H2>\n");

  , there are some unmarked replaceable strings so we need to mark

  This will change the sources/web/{cgi.c,statuspage.c,swat.c} and
  sources/param/loadparm.c. This *should* be fixed.

  And we *had better* choose only one of _() or N_(). I will choose

  3b) to add a script like "make update-po"

  we *should* have a script which pick up the marked strings and
  generate msg files. 

  Using gettext tools is easy to do this. This means we need to
  install GNU gettext only to update msg files. Of course we can
  replace this to the original script later.
  I am now using the attached ad-hoc script:

# placed into sources/po

FILES='../web/swat.c ../web/statuspage.c'
LANGS='en ja'


$XGETTEXT --default-domain="i18n_swat" \
  --add-comments \
  --keyword=_ --keyword=N_  \

for lang in $LANGS; do
  mv ${lang}.msg ${lang}.msg.old
  $MSGMERGE ${lang}.msg.old i18n_swat.po -o ${lang}.msg

  3c) remove meaningless d_printf()
  d_printf() must be used to the strings which can be changed from
  the browser's requested language. But do not need to use for example
  at swat.c:589:


  We *had better* cleanup those to normal print_f().

  Also we *had better* remove unnecessary _() and N_().

TAKAHASHI, Motonobu (monyo)                    monyo at home.monyo.com

More information about the samba-technical mailing list