Bug 413 - SWAT i18n features
Summary: SWAT i18n features
Status: CLOSED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: SWAT (show other bugs)
Version: 3.0.0preX
Hardware: All All
: P3 normal
Target Milestone: 3.0.1
Assignee: Tim Potter
QA Contact:
URL: http://lists.samba.org/pipermail/samb...
Keywords:
Depends on: 412 456 487 489 495 529 530
Blocks:
  Show dependency treegraph
 
Reported: 2003-09-07 09:23 UTC by TAKAHASHI Motonobu
Modified: 2005-08-24 10:28 UTC (History)
1 user (show)

See Also:


Attachments
update msg files and genmsg script (12.06 KB, application/octet-stream)
2003-09-22 13:17 UTC, TAKAHASHI Motonobu
no flags Details
patch to update the calling _( ) (21.68 KB, patch)
2003-09-22 13:18 UTC, TAKAHASHI Motonobu
no flags Details
patch to update the calling _( ) #2 (25.53 KB, patch)
2003-10-02 11:57 UTC, TAKAHASHI Motonobu
no flags Details
update msg files and genmsg script#2 (11.83 KB, application/octet-stream)
2003-10-05 13:39 UTC, TAKAHASHI Motonobu
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description TAKAHASHI Motonobu 2003-09-07 09:23:42 UTC
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
   updated.

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. **
Comment 1 Tim Potter 2003-09-22 00:29:34 UTC
Stealing from djf.  (-:
Comment 2 TAKAHASHI Motonobu 2003-09-22 02:59:07 UTC
Current status for BUG#413

1) and 2) are fixed by BUG#412

4) are fixed by BUG#456

5) There are no documents about this feature.
Please refer to

http://lists.samba.org/pipermail/samba-docs/2003-September/001002.html
Comment 3 TAKAHASHI Motonobu 2003-09-22 13:17:29 UTC
Created attachment 159 [details]
update msg files and genmsg script
Comment 4 TAKAHASHI Motonobu 2003-09-22 13:18:53 UTC
Created attachment 160 [details]
patch to update the calling _( )
Comment 5 TAKAHASHI Motonobu 2003-09-22 19:11:10 UTC
| --> (https://bugzilla.samba.org/attachment.cgi?id=159&action=view)
|update msg files and genmsg script

This file contains the update msg files and genmsg script which is
based in 3b) in
<http://lists.samba.org/pipermail/samba-technical/2003-September/046924.html>

| --> (https://bugzilla.samba.org/attachment.cgi?id=160&action=view)
|patch to update the calling _( )

This is the main patch file which

1) pick up proper strings to call msg strings for example to add
  strings in wizard menu in web/swat.c, web/statuspage.c and
  param/loadparm.c.

2) define N_() macro in include/intl.h to pick up some strings
  in param/loadparm.c

3) quote all name and value tag with '"'
  For example in swat.c:720 the "Edit Parameter Values" string is
  displayd only as "Edit" because value tag is not quoted like:
  value=Edit Parameter Values
  These tags should be quoted though it sometimes works well
  without quotation.

4) modify the msg strings not to contain HTML tags or other
  non-message strings ASAP. For example
  dprintf(_("test\n")); is modified to dprintf("%s\n", _("test"));


There are still some issues:

I) BUG#489: d_printf() cannot handle '\"'

II) please remove old gif files under swat/lang/ja/images

III) d_printf() in swat.c:754 really needs?
   d_printf() needs in swat.c after line:740?

IV) For example
 6a) d_printf(_("test %s messege\n"))  is working well but
 6b) d_printf("%s\n", _("test %s messege")) is not working.
 I modified the 6b) format to 6a) format.

 This is currently d_printf() limitation?

V) long strings are not converted with d_printf() for example
  web/swat.c:771: The above...
  I simply seperate this to 2 strings.
  This is also currently d_printf() limitation?

VI) click SHARE icon, then "Share Parameters" will display, also
  click PRINTER icon, then "Printer Parameters" will
  I think click GLOBAL icon, then displaying "Global Parameters (not
  variables)" is more better...?

Comment 6 Tim Potter 2003-09-25 19:04:33 UTC
I have just fixed I), II), III) and VI).

Comment 7 Tim Potter 2003-09-25 19:13:49 UTC
Item IV) is a little tricky.  Due to the fact that the exact string in the
dprintf() function is used as an index to the language tdb, tricks like
d_printf("%s\n", _("test %s messege")) won't work as you point out.

For the i18n to work correctly you can't use a variable number of parameters to
d_printf() unless you are really careful.

For example the msgid string for the first d_printf() would be "<translation of
'test %s message'>\n" whereas what you want is a msgid like "test %s message". 
I.e the string within the _().

This breaks your second patch to update the calling _().  Commands like

d_printf("<input type=radio name=\"ViewMode\" value=0 %s>Basic\n", (mode == 0) ?
"checked" : "");

should become:

d_printf(_("<input type=radio name=\"ViewMode\" value=0 %s>Basic\n"), (mode ==
0) ? "checked" : "");

instead of:

d_printf("<input type=radio name=\"ViewMode\" value=0 %s>%s\n", (mode == 0) ?
"checked" : "", _("Basic"));

Sorry.  )-:
Comment 8 Tim Potter 2003-09-25 23:52:08 UTC
OK here is the status of this bug as I see it.  

  - Monyo's two patches need to be regenerated and applied.

  - The long string parsing as implemented by the load_msg() function
intl/lang_tdb.c

  - Translation files need to be updated for non-English, non-Japanese languages.

Monyo, I can take a look at updating the calling _() patch if you like.  Let me
know what you are going to do.
Comment 9 TAKAHASHI Motonobu 2003-09-26 12:14:31 UTC
At first shall we set the Target milestone to Samba 3.0.1?

In comment#8

>OK here is the status of this bug as I see it.  
>
>  IV) Monyo's two patches need to be regenerated and applied.

Yes...

>  V) The long string parsing as implemented by the load_msg() function
>intl/lang_tdb.c

This issue can be avoided by seperating a long msg strings. So this is a minor 
issue.

>  VII) Translation files need to be updated for non-English, non-Japanese 
>languages.

I will announce them after fixing the issue IV).

And VIII) Documents needs to be added and updated.
  In dev guide:
    How to put messages into d_printf().
    d_printf() limitations.
  In HOW-TO:
    updated current docs in SWAT.xml (for example how to install)
    how to disable this feature (maybe configure options is better?)

  Shall I make a new BUG# about this documentation issue?

About issue IV), assuming commands like

d_printf("<input type=radio name=\"ViewMode\" value=0 %s>Basic\n", (mode == 0) ?
"checked" : "");

the solutions are:

(1) Always writing like

d_printf(_("<input type=radio name=\"ViewMode\" value=0 %s>Basic\n"), (mode ==
0) ? "checked" : "");

This is an easy way but I do not like it because 
  1a) HTML strings are included in msg strings,
  1b) Simply ugly to look :-(
  1c) msg srings become longer and increased because for example "basic" 
and "<li>basic\n" are counted as different msgs.

(2) Writing like 

d_printf("<input type=radio name=\"ViewMode\" value=0 %s>%s\n", (mode == 0) ?
"checked" : "", _("Basic"));

when possible and when valiable is included in msg string, writing like (3).

This can seperate the "essential" messege and HTML tags basically but 
there are 2 syntax for writing d_printf() depended on a variable is included or 
not.

(3) Always writing like

d_printf("<input type=radio name=\"ViewMode\" value=0 ", _("Basic"), ">%s\n", 
(mode == 0) ?
"checked" : "");

This is the most acceptable resolution I think.

How about (3)?
Comment 10 Tim Potter 2003-09-26 18:18:23 UTC
Setting milestone to 3.0.1
Comment 11 TAKAHASHI Motonobu 2003-09-28 01:53:58 UTC
Sorry I had some big mistakes :-(

V) is not a problem, the long strings can work well.

So the existing problems are now IV), VII) and VIII) only.


For IV), I mistook again. (3) in #comment_9 causes syntax error.

At last I want to modify:

If the msg strings do not contain variables, then writing like 
    d_printf("%s\n", _("test messege"));
If contain, then
  writing like
    d_printf(_("test %s messege"));
    d_printf("\n");

Of course this is NOT the best solution. But is acceptable.
Because
  the HTML tags are not included in msg files. 
  indeed there are few msg strings included variables.

If you are OK, I will re-generate the patch and msg files.
Comment 12 Tim Potter 2003-09-28 03:38:59 UTC
Monyo, I will be happy to look at any patches you send.

As a point of order, I am wondering whether it might have been better to break
this bug up in to lots of little bugs to make things easier to keep track of. 
Perhaps have a placeholder bug like we do now but with more dependent bugs.  I
think that would work well.
Comment 13 TAKAHASHI Motonobu 2003-09-28 10:11:06 UTC
At comment#12,
As a point of order, I am wondering whether it might have been better to break
this bug up in to lots of little bugs to make things easier to keep track of.

I agreed and created BUG#529 and BUG#530 .

From the first, I planned that only trival (need not to discuss) problem will 
be discussed in this case and to create a new BUG for each issues as you said. 
But IV) grows more annoying than I have thought at first :-(
Comment 14 TAKAHASHI Motonobu 2003-10-02 11:57:58 UTC
Created attachment 176 [details]
patch to update the calling _( ) #2 

This patch is fixed issues described below:

1) pick up proper strings to call msg strings for example to add
  strings in wizard menu in web/swat.c, web/statuspage.c and
  param/loadparm.c.

2) define N_() macro in include/intl.h to pick up some strings
  in param/loadparm.c

3) quote all name and value tag with '"'
  For example in swat.c:720 the "Edit Parameter Values" string is
  displayd only as "Edit" because value tag is not quoted like:
  value=Edit Parameter Values
  These tags should be quoted though it sometimes works well
  without quotation.

4) modify the msg strings not to contain HTML tags or other
  non-message strings. For example
  dprintf(_("test\n")); is modified to dprintf("%s\n", _("test"));

  Refer to BUG#529.
Comment 15 Tim Potter 2003-10-02 18:45:14 UTC
Checked in.

I don't think 4) is going to work as well as you think it is though.
Comment 16 TAKAHASHI Motonobu 2003-10-04 10:19:27 UTC
>I don't think 4) is going to work as well as you think it is though.

Indeed this patch works well.
I tested Japanese, Germany and French.

You can test this feature to set your browse's language for example de 
(Germany), fr(French) and copy proper msg file into $LIBDIR.
Comment 17 TAKAHASHI Motonobu 2003-10-05 13:39:37 UTC
Created attachment 179 [details]
update msg files and genmsg script#2

Updated genmsg script and po files.

1) Inseted copyright strings in genmsg
2) added --width option to both xgettext and msgmerge in genmsg
3) msg files are updated:
  Currently ja.msg and en.msg are completely updated.
  Others need to be filled several msg strings.
Comment 18 Tim Potter 2003-10-06 19:13:45 UTC
Applied - nice work.  All we need now is someone to update the translation files!
Comment 19 Jelmer Vernooij 2003-10-08 08:58:43 UTC
Dutch has been updated. That leaves it, de, fr, pl and tr. and some new ones,
perhaps?
Comment 20 Tim Potter 2003-11-05 08:54:06 UTC
What's the status of the remaining things to be done for swat i18n?  If you want
to get stuff in to 3.0.1 we had better get moving now.
Comment 21 TAKAHASHI Motonobu 2003-11-05 09:34:43 UTC
Currently there are 4 bugs, 495 496 529 530.

I think 529 was fixed, 495 and 496 are still remained but are not critical 
issues for SWAT i18n, so I think they can be removed from dependency tree.

For 530, I think I should write the documents, sorry.

So remaining thing is documentation. The code issue is mostly fixed.
Comment 22 Tim Potter 2003-11-06 09:21:16 UTC
Everything seems to be fixed now.
Comment 23 Gerald (Jerry) Carter (dead mail address) 2005-02-07 09:06:19 UTC
originally reported against one of the 3.0.0rc[1-4] releases.
Cleaning up non-production versions.
Comment 24 Gerald (Jerry) Carter (dead mail address) 2005-08-24 10:28:07 UTC
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.