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. **
Stealing from djf. (-:
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
Created attachment 159 [details] update msg files and genmsg script
Created attachment 160 [details] patch to update the calling _( )
| --> (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...?
I have just fixed I), II), III) and VI).
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. )-:
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.
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)?
Setting milestone to 3.0.1
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.
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.
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 :-(
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.
Checked in. I don't think 4) is going to work as well as you think it is though.
>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.
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.
Applied - nice work. All we need now is someone to update the translation files!
Dutch has been updated. That leaves it, de, fr, pl and tr. and some new ones, perhaps?
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.
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.
Everything seems to be fixed now.
originally reported against one of the 3.0.0rc[1-4] releases. Cleaning up non-production versions.
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.