libgweather r520 - trunk/po-locations



Author: danw
Date: Tue Nov 25 20:39:48 2008
New Revision: 520
URL: http://svn.gnome.org/viewvc/libgweather?rev=520&view=rev

Log:
	* Makefile.am: add a rule to regen a po file with more-useful
	sorting of the strings

	* README.translators: explain it


Added:
   trunk/po-locations/README.translators
   trunk/po-locations/extract.xsl
Modified:
   trunk/po-locations/   (props changed)
   trunk/po-locations/ChangeLog
   trunk/po-locations/Makefile.am

Modified: trunk/po-locations/Makefile.am
==============================================================================
--- trunk/po-locations/Makefile.am	(original)
+++ trunk/po-locations/Makefile.am	Tue Nov 25 20:39:48 2008
@@ -1,6 +1,18 @@
 EXTRA_DIST = ChangeLog \
-	POTFILES.in \
-	POTFILES.skip \
-	$(wildcard *.po)
+	$(wildcard *.po) \
+	extract.xsl
+
+CLEANFILES = locations.pot Locations.xml.in.h
 
 DISTCLEANFILES = .intltool-merge-cache
+
+Locations.xml.in.h: $(top_srcdir)/data/Locations.xml.in extract.xsl
+	xsltproc extract.xsl $(top_srcdir)/data/Locations.xml.in > $@
+
+locations.pot: Locations.xml.in.h
+	$(XGETTEXT) --add-comments --output=$@ --from-code=utf-8 --keyword=N_ --keyword=NC_:1c,2 --no-location $^
+
+%.po: locations.pot FORCE
+	$(MSGMERGE) -U $@ locations.pot
+
+FORCE:

Added: trunk/po-locations/README.translators
==============================================================================
--- (empty file)
+++ trunk/po-locations/README.translators	Tue Nov 25 20:39:48 2008
@@ -0,0 +1,38 @@
+By default, intltool/gettext will generate the .po file with the
+entries sorted completely alphabetically. This is not very useful for
+po-locations, so the Makefile here has rules to generate .po files in
+a better order. Do:
+
+	make en_US.po
+
+(substituting "en_US" of course) to regenerate your .po file with the
+entries sorted as follows:
+
+	* Top-level regions (continents, etc), sorted alphabetically
+
+	* Countries, sorted alphabetically
+
+	* Timezone names, not really especially sorted
+
+	* State/Province names, sorted by country, then alphabetically
+	  within each country
+
+	* City names, sorted by country, then alphabetically within
+	  each country
+
+All of the region and country names are immediately visible when
+adding a new location in the gweather-applet, and all of the country
+and timezone names are immediately visible when setting the timezone
+of a location in the clock applet. Thus, every translation will likely
+want to have all of those strings translated.
+
+The state/province and city names are more likely to only be seen by
+people living in those states/cities, and so are less critical to have
+100% translation of; they are sorted by country to make it easy to
+translate the city names in countries where your language is spoken
+first, and worry about the city names in other countries later.
+
+
+If you don't want to use this script, you don't have to, but you will
+need to use intltool 0.40.3 or later to rebuild your .po files from
+now on, because earlier versions don't have msgctxt support.

Added: trunk/po-locations/extract.xsl
==============================================================================
--- (empty file)
+++ trunk/po-locations/extract.xsl	Tue Nov 25 20:39:48 2008
@@ -0,0 +1,56 @@
+<xsl:stylesheet version="1.0"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
+
+  <xsl:output method="text"/>
+
+  <xsl:template name="escape">
+    <xsl:param name="string" />
+    <xsl:choose>
+      <xsl:when test="contains($string, '&amp;')">
+	<xsl:value-of select="substring-before($string, '&amp;')" />&amp;amp;<xsl:call-template name="escape"><xsl:with-param name="string" select="substring-after($string, '&amp;')" /></xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+	<xsl:value-of select="$string" />
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:template>
+
+  <xsl:template name="output_name">
+    <xsl:if test="preceding-sibling::comment()">
+/* <xsl:value-of select="preceding-sibling::comment()"/> */</xsl:if>
+<xsl:choose><xsl:when test="@msgctxt">
+char *s = NC_("<xsl:call-template name="escape"><xsl:with-param name="string" select="@msgctxt"/></xsl:call-template>", "<xsl:call-template name="escape"><xsl:with-param name="string" select="."/></xsl:call-template>");</xsl:when><xsl:otherwise>
+char *s = N_("<xsl:call-template name="escape"><xsl:with-param name="string" select="."/></xsl:call-template>");</xsl:otherwise></xsl:choose></xsl:template>
+
+  <xsl:template match="gweather">
+      <!-- region names -->
+      <xsl:for-each select="//region/_name">
+	<xsl:sort select="."/>
+	<xsl:call-template name="output_name" /></xsl:for-each>
+
+      <!-- country names -->
+      <xsl:for-each select="//country/_name">
+	<xsl:sort select="."/>
+	<xsl:call-template name="output_name" /></xsl:for-each>
+
+      <!-- timezone names -->
+      <xsl:for-each select="//timezone/_name">
+	<xsl:call-template name="output_name" /></xsl:for-each>
+
+      <!-- state names -->
+      <xsl:for-each select="//state/_name">
+	<xsl:sort select="ancestor::country/_name"/>
+	<xsl:sort select="."/>
+	<xsl:call-template name="output_name" /></xsl:for-each>
+
+      <!-- city names -->
+      <xsl:for-each select="//city/_name">
+	<xsl:sort select="ancestor::country/_name"/>
+	<xsl:sort select="."/>
+	<xsl:call-template name="output_name" /></xsl:for-each>
+
+      <xsl:text>
+</xsl:text>
+  </xsl:template>
+
+</xsl:stylesheet>



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