[gtksourceview/wip/dont-use-intltool: 5/9] i18n: use itstool to extract strings from the glade catalog



commit 77878887138825cb7a9e069bd7720d2c3ae81e42
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Aug 12 17:42:31 2015 +0200

    i18n: use itstool to extract strings from the glade catalog
    
    Glade doesn't support '_name' attributes, it must be 'name'. With the
    ITS rules the strings are correctly extracted, but in the xml file it's
    less clear what is translated. Maybe a better solution is to run a sed
    command to rename _name -> name. Or an even better solution is to
    support _name attributes in glade, like we do for .lang files and style
    schemes in GtkSourceView.

 data/glade/Makefile.am                             |   15 +++++----
 data/glade/glade.its                               |    7 ++++
 .../{gtksourceview.xml.in => gtksourceview.xml}    |   32 ++++++++++++--------
 po/POTFILES.in                                     |    2 +-
 4 files changed, 36 insertions(+), 20 deletions(-)
---
diff --git a/data/glade/Makefile.am b/data/glade/Makefile.am
index 27e73a0..76764de 100644
--- a/data/glade/Makefile.am
+++ b/data/glade/Makefile.am
@@ -6,15 +6,18 @@
 # and want to use the catalog in glade, you will need to set
 # the GLADE_CATALOG_SEARCH_PATH environment variable.
 catalogdir = $(datadir)/glade/catalogs
-catalog_in_files = gtksourceview.xml.in
-catalog_DATA = $(catalog_in_files:.xml.in=.xml)
-
-EXTRA_DIST = \
-       $(catalog_in_files)
+catalog_DATA = gtksourceview.xml
 
 validate: $(catalog_DATA)
        xmllint --dtdvalid $(GLADE_CATALOG_DIR)/glade-catalog.dtd --noout $<
 
-CLEANFILES = $(catalog_DATA)
+EXTRA_DIST = glade.its
+
+glade.pot: $(catalog_DATA) glade.its
+       $(ITSTOOL) -i glade.its -o $@ $(catalog_DATA)
+
+all-local: glade.pot
+
+CLEANFILES = glade.pot
 
 -include $(top_srcdir)/git.mk
diff --git a/data/glade/glade.its b/data/glade/glade.its
new file mode 100644
index 0000000..082400a
--- /dev/null
+++ b/data/glade/glade.its
@@ -0,0 +1,7 @@
+<its:rules
+  xmlns:its="http://www.w3.org/2005/11/its";
+  version="1.0">
+
+  <its:translateRule translate="no" selector="/glade-catalog" />
+  <its:translateRule translate="yes" selector="//value/@name" />
+</its:rules>
diff --git a/data/glade/gtksourceview.xml.in b/data/glade/gtksourceview.xml
similarity index 63%
rename from data/glade/gtksourceview.xml.in
rename to data/glade/gtksourceview.xml
index f17d471..a017dbd 100644
--- a/data/glade/gtksourceview.xml.in
+++ b/data/glade/gtksourceview.xml
@@ -1,5 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<glade-catalog version="3.0" supports="gtkbuilder" name="gtksourceview" library="gtksourceview-3.0" 
domain="gtksourceview-3.0" depends="gtk+" book="gtksourceview-3.0">
+<glade-catalog version="3.0"
+               supports="gtkbuilder"
+               name="gtksourceview"
+               library="gtksourceview-3.0"
+               domain="gtksourceview-3.0"
+               depends="gtk+"
+               book="gtksourceview-3.0">
   <glade-widget-classes>
     <glade-widget-class name="GtkSourceView" title="GtkSourceView" generic-name="gtksourceview">
       <properties>
@@ -14,23 +20,23 @@
         <property id="smart-home-end" default="Disabled">
           <displayable-values>
             <!-- Translators: It is related to an option of a set of values -->
-            <value id="GTK_SOURCE_SMART_HOME_END_DISABLED" _name="Disabled" />
-            <value id="GTK_SOURCE_SMART_HOME_END_BEFORE" _name="Before" />
-            <value id="GTK_SOURCE_SMART_HOME_END_AFTER" _name="After" />
-            <value id="GTK_SOURCE_SMART_HOME_END_ALWAYS" _name="Always" />
+            <value id="GTK_SOURCE_SMART_HOME_END_DISABLED" name="Disabled" />
+            <value id="GTK_SOURCE_SMART_HOME_END_BEFORE" name="Before" />
+            <value id="GTK_SOURCE_SMART_HOME_END_AFTER" name="After" />
+            <value id="GTK_SOURCE_SMART_HOME_END_ALWAYS" name="Always" />
           </displayable-values>
         </property>
         <property id="tab-width" default="8" />
         <property id="draw-spaces">
           <displayable-values>
-            <value id="GTK_SOURCE_DRAW_SPACES_SPACE" _name="Space" />
-            <value id="GTK_SOURCE_DRAW_SPACES_TAB" _name="Tab" />
-            <value id="GTK_SOURCE_DRAW_SPACES_NEWLINE" _name="Newline" />
-            <value id="GTK_SOURCE_DRAW_SPACES_NBSP" _name="Non Breaking Whitespace" />
-            <value id="GTK_SOURCE_DRAW_SPACES_LEADING" _name="Leading" />
-            <value id="GTK_SOURCE_DRAW_SPACES_TEXT" _name="Text" />
-            <value id="GTK_SOURCE_DRAW_SPACES_TRAILING" _name="Trailing" />
-            <value id="GTK_SOURCE_DRAW_SPACES_ALL" _name="All" />
+            <value id="GTK_SOURCE_DRAW_SPACES_SPACE" name="Space" />
+            <value id="GTK_SOURCE_DRAW_SPACES_TAB" name="Tab" />
+            <value id="GTK_SOURCE_DRAW_SPACES_NEWLINE" name="Newline" />
+            <value id="GTK_SOURCE_DRAW_SPACES_NBSP" name="Non Breaking Whitespace" />
+            <value id="GTK_SOURCE_DRAW_SPACES_LEADING" name="Leading" />
+            <value id="GTK_SOURCE_DRAW_SPACES_TEXT" name="Text" />
+            <value id="GTK_SOURCE_DRAW_SPACES_TRAILING" name="Trailing" />
+            <value id="GTK_SOURCE_DRAW_SPACES_ALL" name="All" />
           </displayable-values>
         </property>
       </properties>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 458dba6..4b5682d 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,4 +1,4 @@
-data/glade/gtksourceview.xml.in
+data/glade/glade.pot
 data/language-specs/language-specs.pot
 data/styles/styles.pot
 gtksourceview/completion-providers/words/gtksourcecompletionwords.c


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]