GNOME Bugzilla – Bug 45501
should support xml:lang style of localization for merging (for gnumeric, Nautilus themes, etc.)
Last modified: 2004-12-22 21:47:04 UTC
Gnumeric has some template files, (now called .xml, but should be renamed filename.gmr.in). I have made extract and update support this, so the files get into the po. This works fine. Since you wrote the merge code it might be easier for you to impliment this support to merge. I do not know how much that needs to be changed, but the nodes that contains translations start with <gmr:Information Here are my patches and a sample file: --- xml-i18n-tools/xml-i18n-update Fri Jan 5 18:57:34 2001 +++ xml-i18n-update Sat Jan 6 16:06:01 2001 @@ -243,6 +243,16 @@ $xmlfiles="$XML_I18N_EXTRACT --update $filename"; system($XML_I18N_EXTRACT, "--update", $filename); } + + # Find .gmr.in.h files in POTFILES.in and generate + # the files with help from the xml-i18n-extract script + #-------------------------------------------------- + elsif ($_=~ /(.*)(\.gmr\.in)/o){ + $filename = "../$1.gmr.in"; + $xmlfiles="$XML_I18N_EXTRACT --update $filename"; + system($XML_I18N_EXTRACT, "--update", $filename); + } + } close FILE; @@ -270,6 +280,7 @@ s/\.glade$/\.glade\.h/; s/\.xml$/\.xml\.h/; s/\.oaf\.in$/\.oaf\.in\.h/; + s/\.gmr\.in$/\.gmr\.in\.h/; print OUTFILE $_; } close OUTFILE; --- xml-i18n-tools/xml-i18n-extract Fri Jan 5 18:57:33 2001 +++ xml-i18n-extract Sat Jan 6 16:04:53 2001 @@ -116,7 +116,7 @@ sub PreCheck { - if (! $ENABLE_XML) { if ($FILE =~ /(xml|oaf\.in)$/sg) { &WriteError; }} + if (! $ENABLE_XML) { if ($FILE =~ /(xml|oaf\.in|gmr.in)$/sg) { &WriteError; }} if (! $ENABLE_GLADE) { if ($FILE =~ /glade$/sg) { &WriteError; }} if (! $ENABLE_XP) { if ($FILE =~ /\/xp\/(.*)\.h$/sg) { &WriteError; }} } @@ -206,7 +206,7 @@ ### For generic translatable XML files ### - if ($FILE =~ /(xml|oaf.in)$/sg){ + if ($FILE =~ /(xml|oaf.in|gmr.in)$/sg){ while ($input =~ /[\t\n\s]_[a-zA-Z0-9_]+=\"([^\"]+)\"/sg) { $string{$1} = []; } --sample file--- (autoformat.General.basic.xml) <?xml version="1.0"?> <gmr:FormatTemplate xmlns:gmr="http://www.gnome.org/gnumeric/format-template/v1"> <gmr:Information _author="Gnumeric Team" _name="Basic" _description="A basic formal style" _category="General"/> <gmr:Members> <gmr:Member> <gmr:Row> <gmr:Placement offset="0" offset_gravity="1"/> <gmr:Dimensions size="1"/> </gmr:Row> <gmr:Col> <gmr:Placement offset="0" offset_gravity="1"/> <gmr:Dimensions size="0"/> </gmr:Col> <gmr:Frequency direction="0" repeat="0" skip="0" edge="0"/> <gmr:Style HAlign="8" VAlign="2" Fit="0" Orient="1" Shade="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General"> <gmr:Font Unit="9" Bold="1" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font> <gmr:StyleBorder> <gmr:Top Style="2" Color="0:0:0"/> <gmr:Bottom Style="1" Color="0:0:0"/> <gmr:Left Style="0"/> <gmr:Right Style="0"/> <gmr:Diagonal Style="0"/> <gmr:Rev-Diagonal Style="0"/> </gmr:StyleBorder> </gmr:Style> </gmr:Member> <gmr:Member> <gmr:Row> <gmr:Placement offset="0" offset_gravity="-1"/> <gmr:Dimensions size="1"/> </gmr:Row> <gmr:Col> <gmr:Placement offset="1" offset_gravity="1"/> <gmr:Dimensions size="0"/> </gmr:Col> <gmr:Frequency direction="0" repeat="0" skip="0" edge="0"/> <gmr:Style HAlign="1" VAlign="2" Fit="0" Orient="1" Shade="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General"> <gmr:Font Unit="9" Bold="0" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font> <gmr:StyleBorder> <gmr:Top Style="1" Color="0:0:0"/> <gmr:Bottom Style="2" Color="0:0:0"/> <gmr:Left Style="0"/> <gmr:Right Style="0"/> <gmr:Diagonal Style="0"/> <gmr:Rev-Diagonal Style="0"/> </gmr:StyleBorder> </gmr:Style> </gmr:Member> <gmr:Member> <gmr:Row> <gmr:Placement offset="0" offset_gravity="-1"/> <gmr:Dimensions size="1"/> </gmr:Row> <gmr:Col> <gmr:Placement offset="0" offset_gravity="1"/> <gmr:Dimensions size="1"/> </gmr:Col> <gmr:Frequency direction="0" repeat="0" skip="0" edge="0"/> <gmr:Style HAlign="1" VAlign="2" Fit="0" Orient="1" Shade="0" Fore="0:0:0" Back="FFFF:FFFF:FFFF" PatternColor="0:0:0" Format="General"> <gmr:Font Unit="9" Bold="1" Italic="0" Underline="0" StrikeThrough="0">Helvetica</gmr:Font> <gmr:StyleBorder> <gmr:Top Style="1" Color="0:0:0"/> <gmr:Bottom Style="2" Color="0:0:0"/> <gmr:Left Style="0"/> <gmr:Right Style="0"/> <gmr:Diagonal Style="0"/> <gmr:Rev-Diagonal Style="0"/> </gmr:StyleBorder> </gmr:Style> </gmr:Member> </gmr:Members> </gmr:FormatTemplate> ------- Additional Comments From kenneth@gnu.org 2001-01-06 11:58:49 ---- here is how output should look: <gmr:Information author="Gnumeric Team" name="Banana" description="A banana coloured template" category="Colourful"/> <gmr:Information xml:lang="pl" author="Zespó³ Gnumerica" name="Bananowy" description="Szablon w kolorze bananowym" category="Kolorowe"/> ------- Additional Comments From kenneth@gnu.org 2001-01-06 11:59:31 ---- I forgot to mention: Gnumeric already supports this syntax ------- Additional Comments From mjs@noisehavoc.org 2001-01-06 18:31:54 ---- OK, I'm totally happy to do this. Side note: oaf should be changed at some point to use the xml:lang style of translations instead of the different thing it does right now. Maybe this could be the impetus. ------- Additional Comments From mjs@noisehavoc.org 2001-01-06 18:35:13 ---- I think we can also use the xml:lang style of translations for Nautilus theme files and other XML formats in Nautilus that need to be translated, renamign the bug to reflect this. ------- Additional Comments From jgoldberg@home.com 2001-01-06 20:43:15 ---- What is the significance of the .gmr.in suffix ? ------- Additional Comments From mjs@noisehavoc.org 2001-01-06 22:04:56 ---- Cc'd Jody so he can follow the discussion. I assume Kenneth suggested .gmr.in for the extension so that after they are processed the suffix will be .gmr; but I don't know why he thinks .gmr is a good suffix for those particular files. I'm not sure where to find the relevant files in the gnumeric repository either. ------- Additional Comments From jgoldberg@home.com 2001-01-06 22:56:48 ---- The files are in gnumeric/templates/autoformat I am not clear on 1) Why the files need to be preprocessed. eg how does the content of the proposed .gmr file diff from the .gmr.in file. 2) What is the benefit of the .gmr suffix ? From the look of the proposed patch .xml was already handled. What does this do differently ? ------- Additional Comments From mjs@noisehavoc.org 2001-01-07 02:10:49 ---- Jody, First off, Kenneth probably should have talked to you about this stuff before filing this bug. I'd be glad to discuss it on IRC sometime so we can figure out the right thing to do; I want a solution that makes both you and the translators happy. I'm only guessing at these, since it was Kenneth's suggestion, but here's my best guesses: 1) the .in version of the files would contain only the English versions of translatable strings, marked for translation. xml-i18n-extract would go over these files and extract the strings to gnumeric.pot. In turn, the translators would put translations of the strings in the individual .po files. Then, at gnumeric build time, xml-i18n-merge would take the .gmr.in files and merge the translations back by looking up the translatable strings in the .po files. The final .gmr files that include the translations get installed. This way, the translators would be able to do translations that get put in the proper template files without having to look at anything but the .po files. Apparently, for many translators, having to look at anything but .po files to find translatable strings or to cause translations to be added is an unacceptable burden. The goal of this merge and extract system is to avoid this but still end up with the translations in the data files themselves. 2) I have no idea what .gmr means, it does not seem like the world's best suffix to use. However, just using .xml makes life tougher for the merge and extract tools, since there are different styles of marking strings translatable and different ways that apps expect translations to be present in the XML file, so from that point of view at least, having different suffixes for different kinds of files is very helpful. However, this is definitely a solvable problem, so what suffix you give the files is not essential. ------- Additional Comments From darin@bentspoon.com 2001-01-08 09:38:17 ---- It would be nice to have gnumeric localizable in the best way with the new tools for GNOME 1.4, but I think it's not necessary. ------- Additional Comments From mjs@noisehavoc.org 2001-01-09 03:56:10 ---- This would also be the correct way to internationalize Nautilus theme files with the new tools, as well as many other XML formats. ------- Bug moved to this database by unknown@bugzilla.gnome.org 2001-09-09 20:51 -------
Change to low as this is not really needed for the moment
Does gnumeric still use .xml template files. Just wanted to know if this is an issue at all.
Yes. Although frankly I'm not sure which of the xml files this bug refers to
Reopening this so we can ask the right questions before NEEDINFOing it again :-)
Isn't it what bug #116526 adds ?
#116526 is fixed so that would be nice to know...
intltool certainly supports this already. From its POV, all that's neccessary is to rename gnumeric/templates/autoformat/*.xml to .xml.in and to prepend underscore on all relevant attributes and tags. With my tests, "intltool-extract --type=text/xml file.xml.in" and "intltool-update -m" cause no problems with these files, and merging is supposed to be tested with testcases ;-) So, it feels like RESOLVED/FIXED with a keyword "LONGTIMEAGO" :) OTOH, there might be some work on Gnumeric side (build system integration, etc).
Rereading this entire report, I think I'm safe closing this.