After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 45501 - should support xml:lang style of localization for merging (for gnumeric, Nautilus themes, etc.)
should support xml:lang style of localization for merging (for gnumeric, Naut...
Status: RESOLVED FIXED
Product: intltool
Classification: Deprecated
Component: general
unspecified
Other Linux
: Low normal
: ---
Assigned To: intltool maintainers
intltool maintainers
Depends on:
Blocks:
 
 
Reported: 2001-01-06 14:18 UTC by Kenneth Rohde Christiansen
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Kenneth Rohde Christiansen 2001-09-10 00:51:17 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 -------
Comment 1 Kenneth Rohde Christiansen 2002-08-28 23:01:27 UTC
Change to low as this is not really needed for the moment
Comment 2 Kenneth Rohde Christiansen 2003-01-05 17:16:26 UTC
Does gnumeric still use .xml template files. Just wanted to know if
this is an issue at all.
Comment 3 Jody Goldberg 2003-01-08 07:26:48 UTC
Yes.  Although frankly I'm not sure which of the xml files this bug refers to
Comment 4 Kjartan Maraas 2003-10-29 10:40:43 UTC
Reopening this so we can ask the right questions before NEEDINFOing it
again :-)
Comment 5 Christophe Fergeau 2003-11-26 14:17:09 UTC
Isn't it what bug  #116526 adds ?
Comment 6 Kenneth Rohde Christiansen 2004-01-07 17:34:12 UTC
#116526 is fixed so that would be nice to know...
Comment 7 Danilo Segan 2004-10-12 13:51:12 UTC
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).
Comment 8 Danilo Segan 2004-10-14 10:54:58 UTC
Rereading this entire report, I think I'm safe closing this.