[glib] Add gettext-domain when required, and allow to specify it on the cmdline
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Add gettext-domain when required, and allow to specify it on the cmdline
- Date: Wed, 21 Apr 2010 02:57:27 +0000 (UTC)
commit 463203ee0aa75e727df3b756fcf589fefc8a99cc
Author: Matthias Clasen <mclasen redhat com>
Date: Tue Apr 20 22:49:32 2010 -0400
Add gettext-domain when required, and allow to specify it on the cmdline
Bug 616309
docs/reference/gio/gsettings-schema-convert.xml | 8 ++++++++
gio/gsettings-schema-convert | 16 +++++++++++++---
2 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/docs/reference/gio/gsettings-schema-convert.xml b/docs/reference/gio/gsettings-schema-convert.xml
index 1d06c3a..b323a99 100644
--- a/docs/reference/gio/gsettings-schema-convert.xml
+++ b/docs/reference/gio/gsettings-schema-convert.xml
@@ -88,6 +88,14 @@ GSettings schema.
</para></listitem>
</varlistentry>
+<varlistentry>
+<term><option>-d <replaceable>DOMAIN</replaceable></option>, <option>--gettext-domain=<replaceable>DOMAIN</replaceable></option></term>
+<listitem><para>
+Use <replaceable>DOMAIN</replaceable> as the gettext domain in the generated
+GSettings schema.
+</para></listitem>
+</varlistentry>
+
</variablelist>
</refsect2>
</refsect1>
diff --git a/gio/gsettings-schema-convert b/gio/gsettings-schema-convert
index dcc4bef..597f652 100755
--- a/gio/gsettings-schema-convert
+++ b/gio/gsettings-schema-convert
@@ -848,8 +848,9 @@ class GConfSchema:
class GConfSchemaParser:
- def __init__(self, file, default_schema_id):
+ def __init__(self, file, default_gettext_domain, default_schema_id):
self.file = file
+ self.default_gettext_domain = default_gettext_domain
self.default_schema_id = default_schema_id
self.root = None
@@ -950,7 +951,10 @@ class GConfSchemaParser:
gconfschemafile_node = ET.parse(self.file).getroot()
for schemalist_node in gconfschemafile_node.findall('schemalist'):
for schema_node in schemalist_node.findall('schema'):
- self._insert_schema(GConfSchema(schema_node))
+ gconf_schema = GConfSchema(schema_node)
+ if gconf_schema.localized:
+ self.root.gettext_domain = self.default_gettext_domain or 'FIXME'
+ self._insert_schema(gconf_schema)
self._fix_hierarchy()
@@ -967,6 +971,8 @@ def main(args):
help="output file")
parser.add_option("-g", "--gconf", action="store_true", dest="gconf",
default=False, help="convert a gconf schema file")
+ parser.add_option("-d", "--gettext-domain", dest="gettext_domain",
+ help="default gettext domain to use when converting gconf schema file")
parser.add_option("-i", "--schema-id", dest="schema_id",
help="default schema ID to use when converting gconf schema file")
parser.add_option("-s", "--simple", action="store_true", dest="simple",
@@ -989,6 +995,10 @@ def main(args):
print >> sys.stderr, 'Too many output formats requested.'
return 1
+ if not options.gconf and options.gettext_domain:
+ print >> sys.stderr, 'Default gettext domain can only be specified when converting a gconf schema.'
+ return 1
+
if not options.gconf and options.schema_id:
print >> sys.stderr, 'Default schema ID can only be specified when converting a gconf schema.'
return 1
@@ -1010,7 +1020,7 @@ def main(args):
options.simple = True
try:
- parser = GConfSchemaParser(argfile, options.schema_id)
+ parser = GConfSchemaParser(argfile, options.gettext_domain, options.schema_id)
schema_root = parser.parse()
except SyntaxError, e:
raise GSettingsSchemaConvertException('\'%s\' does not look like a valid gconf schema file: %s' % (argfile, e))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]