From: Matthias Clasen Date: Wed, 21 Apr 2010 02:49:32 +0000 (-0400) Subject: Add gettext-domain when required, and allow to specify it on the cmdline X-Git-Tag: 2.25.2~39 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=463203ee0aa75e727df3b756fcf589fefc8a99cc;p=platform%2Fupstream%2Fglib.git Add gettext-domain when required, and allow to specify it on the cmdline Bug 616309 --- 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. + +, + +Use DOMAIN as the gettext domain in the generated +GSettings schema. + + + 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))