Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/intltool/ChangeLog,v
retrieving revision 1.390
diff -u -r1.390 ChangeLog
--- ChangeLog	5 Apr 2004 23:12:28 -0000	1.390
+++ ChangeLog	6 May 2004 16:17:12 -0000
@@ -1,3 +1,23 @@
+2004-05-06  Danilo Šegan  <dsegan@gmx.net>
+
+	* tests/cases/schemasmerge1.po: Remove bracketed comment from string.
+	* tests/cases/schemasmerge2.po: Likewise.
+
+	* tests/selftest.pl.in (check_merge_result): Add a new testcase.
+
+	* tests/results/extract-comments.xml.h: Added.
+	* tests/cases/extract-comments.xml: Added a test case.
+
+	* tests/results/test.schemas.in.h (s): Adjust results.
+	* tests/cases/test.schemas.in: Modify comment for new syntax.
+
+	* README: Document additions regarding translators' comments in 
+	XML files.
+
+	* intltool-merge.in.in: Ignore comments when merging.
+	* intltool-extract.in.in (type_xml): Add support for comments.
+	(type_schemas): Likewise.
+
 2004-04-06  Danilo Šegan  <dsegan@gmx.net>
 
 	* intltool-update.in.in:
Index: README
===================================================================
RCS file: /cvs/gnome/intltool/README,v
retrieving revision 1.23
diff -u -r1.23 README
--- README	22 Jan 2004 00:46:49 -0000	1.23
+++ README	6 May 2004 16:17:14 -0000
@@ -247,3 +247,15 @@
 
 Default keywords xgettext looks for if no XGETTEXT_KEYWORDS is defined
 are _, N_ and U_. 
+
+
+Translators' comments in XML and .schemas files
+...............................................
+
+To provide comments to translators in free-form XML or .schema files, 
+you need to precede the string to be translated with the plain XML 
+comment.  If comments contain character ">", they will be ignored
+(this is implementation issue, should be fixed in the future).
+
+In .schemas files, comments need to be inside <default>, <short> or 
+<long> elements (i.e. they cannot be before the opening tag).
Index: intltool-extract.in.in
===================================================================
RCS file: /cvs/gnome/intltool/intltool-extract.in.in,v
retrieving revision 1.56
diff -u -r1.56 intltool-extract.in.in
--- intltool-extract.in.in	6 Jan 2004 23:44:12 -0000	1.56
+++ intltool-extract.in.in	6 May 2004 16:17:17 -0000
@@ -270,14 +270,15 @@
         $messages{entity_decode_minimal($1)} = [];
     }
 
-    while ($input =~ /<_($w+)(?: xml:space="($w+)")?>(.+?)<\/_\1>/sg) {
-        $_ = $3;
-        if (!defined($2) || $2 ne "preserve") {
+    while ($input =~ /(?:<!--([^>]*?)-->\s*)?<_($w+)(?: xml:space="($w+)")?>(.+?)<\/_\2>/sg) {
+        $_ = $4;
+        if (!defined($3) || $3 ne "preserve") {
             s/\s+/ /g;
             s/^ //;
             s/ $//;
         }
         $messages{entity_decode_minimal($_)} = [];
+        $comments{entity_decode_minimal($_)} = $1 if (defined($1));
     }
 }
 
@@ -287,16 +288,19 @@
     # FIXME: We should handle escaped < (less than)
     while ($input =~ /
                       <locale\ name="C">\s*
-                          (<default>\s*(.*?)\s*<\/default>\s*)?
-                          (<short>\s*(.*?)\s*<\/short>\s*)?
-                          (<long>\s*(.*?)\s*<\/long>\s*)?
+                          (<default>\s*(?:<!--([^>]*?)-->\s*)?(.*?)\s*<\/default>\s*)?
+                          (<short>\s*(?:<!--([^>]*?)-->\s*)?(.*?)\s*<\/short>\s*)?
+                          (<long>\s*(?:<!--([^>]*?)-->\s*)?(.*?)\s*<\/long>\s*)?
                       <\/locale>
                      /sgx) {
-        my @totranslate = ($2,$4,$6);
+        my @totranslate = ($3,$6,$9);
+        my @eachcomment = ($2,$5,$8);
         foreach (@totranslate) {
+            my $currentcomment = shift @eachcomment;
             next if !$_;
-        s/\s+/ /g;
-        $messages{entity_decode_minimal($_)} = [];
+            s/\s+/ /g;
+            $messages{entity_decode_minimal($_)} = [];
+            $comments{entity_decode_minimal($_)} = $currentcomment if (defined($currentcomment));
         }
     }
 }
Index: intltool-merge.in.in
===================================================================
RCS file: /cvs/gnome/intltool/intltool-merge.in.in,v
retrieving revision 1.93
diff -u -r1.93 intltool-merge.in.in
--- intltool-merge.in.in	2 Mar 2004 22:06:41 -0000	1.93
+++ intltool-merge.in.in	6 May 2004 16:17:22 -0000
@@ -1107,9 +1107,9 @@
     while ($source =~ s/
                         (.*?)
                         (\s+)(<locale\ name="C">(\s*)
-                            (<default>\s*(.*?)\s*<\/default>)?(\s*)
-                            (<short>\s*(.*?)\s*<\/short>)?(\s*)
-                            (<long>\s*(.*?)\s*<\/long>)?(\s*)
+                            (<default>\s*(?:<!--[^>]*?-->\s*)?(.*?)\s*<\/default>)?(\s*)
+                            (<short>\s*(?:<!--[^>]*?-->\s*)?(.*?)\s*<\/short>)?(\s*)
+                            (<long>\s*(?:<!--[^>]*?-->\s*)?(.*?)\s*<\/long>)?(\s*)
                         <\/locale>)
                        //sx) 
     {
Index: tests/selftest.pl.in
===================================================================
RCS file: /cvs/gnome/intltool/tests/selftest.pl.in,v
retrieving revision 1.30
diff -u -r1.30 selftest.pl.in
--- tests/selftest.pl.in	6 Dec 2003 13:22:58 -0000	1.30
+++ tests/selftest.pl.in	6 May 2004 16:17:23 -0000
@@ -174,4 +174,9 @@
 system("$INTLTOOL_MERGE -x -s --quiet --multiple-output cases cases/$case.in $case") == 0 or $failed = 1;
 check_merge_result($case);
 
+print "19. Extract comments for translators from XML file:                  ";
+$case = "extract-comments.xml";
+system("$INTLTOOL_EXTRACT --type=gettext/xml --quiet --update cases/$case") == 0 or $failed = 1;
+check_extract_result($case);
+
 exit $failed;
Index: tests/cases/schemasmerge1.po
===================================================================
RCS file: /cvs/gnome/intltool/tests/cases/schemasmerge1.po,v
retrieving revision 1.1
diff -u -r1.1 schemasmerge1.po
--- tests/cases/schemasmerge1.po	3 Oct 2002 14:15:16 -0000	1.1
+++ tests/cases/schemasmerge1.po	6 May 2004 16:17:24 -0000
@@ -17,9 +17,7 @@
 msgstr ""
 
 #: extract11.schemas.in.h:2
-msgid ""
-"[default value for /schemas/apps/clock_applet/prefs/hour_format The "
-"translation should only include the localized default eg. 12 or 24 ]24"
+msgid "24"
 msgstr "12"
 
 #: extract11.schemas.in.h:3
Index: tests/cases/schemasmerge2.po
===================================================================
RCS file: /cvs/gnome/intltool/tests/cases/schemasmerge2.po,v
retrieving revision 1.1
diff -u -r1.1 schemasmerge2.po
--- tests/cases/schemasmerge2.po	3 Oct 2002 14:15:16 -0000	1.1
+++ tests/cases/schemasmerge2.po	6 May 2004 16:17:24 -0000
@@ -17,9 +17,7 @@
 msgstr "24"
 
 #: extract11.schemas.in.h:2
-msgid ""
-"[default value for /schemas/apps/clock_applet/prefs/hour_format The "
-"translation should only include the localized default eg. 12 or 24 ]24"
+msgid "24"
 msgstr ""
 
 #: extract11.schemas.in.h:3
Index: tests/cases/test.schemas.in
===================================================================
RCS file: /cvs/gnome/intltool/tests/cases/test.schemas.in,v
retrieving revision 1.2
diff -u -r1.2 test.schemas.in
--- tests/cases/test.schemas.in	16 Oct 2002 14:13:46 -0000	1.2
+++ tests/cases/test.schemas.in	6 May 2004 16:17:24 -0000
@@ -7,9 +7,9 @@
         <owner>clock-applet</owner>
         <type>int</type>
         <locale name="C">
-          <default>[default value for /schemas/apps/clock_applet/prefs/hour_format  
+          <default><!-- default value for /schemas/apps/clock_applet/prefs/hour_format  
                     The translation should only include the localized default
-                    eg. 12 or 24 ]24</default>
+                    eg. 12 or 24 -->24</default>
           <short>Hour format</short>
           <long>Sets the hour format, may be either 12 or 24</long>
         </locale>
Index: tests/results/test.schemas
===================================================================
RCS file: /cvs/gnome/intltool/tests/results/test.schemas,v
retrieving revision 1.2
diff -u -r1.2 test.schemas
--- tests/results/test.schemas	16 Oct 2002 14:13:46 -0000	1.2
+++ tests/results/test.schemas	6 May 2004 16:17:24 -0000
@@ -7,7 +7,9 @@
         <owner>clock-applet</owner>
         <type>int</type>
         <locale name="C">
-          <default>24</default>
+          <default><!-- default value for /schemas/apps/clock_applet/prefs/hour_format  
+                    The translation should only include the localized default
+                    eg. 12 or 24 -->24</default>
           <short>Hour format</short>
           <long>Sets the hour format, may be either 12 or 24</long>
         </locale>
Index: tests/results/test.schemas.in.h
===================================================================
RCS file: /cvs/gnome/intltool/tests/results/test.schemas.in.h,v
retrieving revision 1.2
diff -u -r1.2 test.schemas.in.h
--- tests/results/test.schemas.in.h	3 Oct 2002 14:21:31 -0000	1.2
+++ tests/results/test.schemas.in.h	6 May 2004 16:17:24 -0000
@@ -1,7 +1,10 @@
 char *s = N_("12");
+/*  default value for /schemas/apps/clock_applet/prefs/hour_format  
+                    The translation should only include the localized default
+                    eg. 12 or 24  */
+char *s = N_("24");
 char *s = N_("Display seconds in time");
 char *s = N_("Hour format");
 char *s = N_("Puh long.");
 char *s = N_("Sets the hour format, may be either 12 or 24");
 char *s = N_("Something random..even has >");
-char *s = N_("[default value for /schemas/apps/clock_applet/prefs/hour_format The translation should only include the localized default eg. 12 or 24 ]24");
