[glib] gsettings: Install gettext ITS rules
- From: Daiki Ueno <dueno src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gsettings: Install gettext ITS rules
- Date: Fri, 8 Jan 2016 03:32:29 +0000 (UTC)
commit 50645b724a3b43767fd57e4af53365d0cd270382
Author: Daiki Ueno <dueno src gnome org>
Date: Tue Jan 5 11:07:05 2016 +0900
gsettings: Install gettext ITS rules
Recent gettext has a feature to allow consumer projects to supply their
own string extraction rules for XML files, in ITS format.
Gettext still ships the rule for *.gschema.xml, but it would be better
maintained in the upstream project.
See the gettext documentation for details:
http://www.gnu.org/software/gettext/manual/html_node/Preparing-ITS-Rules.html
https://bugzilla.gnome.org/show_bug.cgi?id=760199
gio/Makefile.am | 3 +++
gio/gschema.its | 25 +++++++++++++++++++++++++
gio/gschema.loc | 10 ++++++++++
3 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/gio/Makefile.am b/gio/Makefile.am
index 5d5d741..3aff3e5 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -746,6 +746,9 @@ gsettings_SOURCES = gsettings-tool.c
schemadir = $(datadir)/glib-2.0/schemas
dist_schema_DATA = gschema.dtd
+itsdir = $(datadir)/gettext/its
+dist_its_DATA = gschema.loc gschema.its
+
# ------------------------------------------------------------------------
# gdbus(1) tool
diff --git a/gio/gschema.its b/gio/gschema.its
new file mode 100644
index 0000000..344c54b
--- /dev/null
+++ b/gio/gschema.its
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<!--
+See the gettext documentation for the file format:
+http://www.gnu.org/software/gettext/manual/html_node/Preparing-ITS-Rules.html
+-->
+<its:rules xmlns:its="http://www.w3.org/2005/11/its"
+ xmlns:gt="https://www.gnu.org/s/gettext/ns/its/extensions/1.0"
+ version="2.0">
+ <its:translateRule selector="/schemalist" translate="no"/>
+
+ <its:translateRule selector="//summary | //description" translate="yes"/>
+
+ <its:translateRule selector="//default[ l10n]" translate="yes"/>
+
+ <!-- The 'context' attribute should be extracted as msgctxt. -->
+ <gt:contextRule selector="//default[ context]" contextPointer="@context"/>
+ <gt:escapeRule selector="//default/@context" escape="no"/>
+
+ <!-- Remove whitespaces around the default value. -->
+ <gt:preserveSpaceRule selector="//default" space="trim"/>
+
+ <!-- Extracted strings are consumed by the library and are never
+ merged back; we don't want to escape special characters. -->
+ <gt:escapeRule selector="/schemalist" escape="no"/>
+</its:rules>
diff --git a/gio/gschema.loc b/gio/gschema.loc
new file mode 100644
index 0000000..8945230
--- /dev/null
+++ b/gio/gschema.loc
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<!--
+See the gettext documentation for the file format:
+http://www.gnu.org/software/gettext/manual/html_node/Preparing-ITS-Rules.html
+-->
+<locatingRules>
+ <locatingRule name="GSettings" pattern="*.gschema.xml">
+ <documentRule localName="schemalist" target="gschema.its"/>
+ </locatingRule>
+</locatingRules>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]