mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 18:26:19 +01:00
Add gettext-domain when required, and allow to specify it on the cmdline
Bug 616309
This commit is contained in:
parent
bedf4c3259
commit
463203ee0a
@ -88,6 +88,14 @@ GSettings schema.
|
|||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</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>
|
</variablelist>
|
||||||
</refsect2>
|
</refsect2>
|
||||||
</refsect1>
|
</refsect1>
|
||||||
|
@ -848,8 +848,9 @@ class GConfSchema:
|
|||||||
|
|
||||||
class GConfSchemaParser:
|
class GConfSchemaParser:
|
||||||
|
|
||||||
def __init__(self, file, default_schema_id):
|
def __init__(self, file, default_gettext_domain, default_schema_id):
|
||||||
self.file = file
|
self.file = file
|
||||||
|
self.default_gettext_domain = default_gettext_domain
|
||||||
self.default_schema_id = default_schema_id
|
self.default_schema_id = default_schema_id
|
||||||
|
|
||||||
self.root = None
|
self.root = None
|
||||||
@ -950,7 +951,10 @@ class GConfSchemaParser:
|
|||||||
gconfschemafile_node = ET.parse(self.file).getroot()
|
gconfschemafile_node = ET.parse(self.file).getroot()
|
||||||
for schemalist_node in gconfschemafile_node.findall('schemalist'):
|
for schemalist_node in gconfschemafile_node.findall('schemalist'):
|
||||||
for schema_node in schemalist_node.findall('schema'):
|
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()
|
self._fix_hierarchy()
|
||||||
|
|
||||||
@ -967,6 +971,8 @@ def main(args):
|
|||||||
help="output file")
|
help="output file")
|
||||||
parser.add_option("-g", "--gconf", action="store_true", dest="gconf",
|
parser.add_option("-g", "--gconf", action="store_true", dest="gconf",
|
||||||
default=False, help="convert a gconf schema file")
|
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",
|
parser.add_option("-i", "--schema-id", dest="schema_id",
|
||||||
help="default schema ID to use when converting gconf schema file")
|
help="default schema ID to use when converting gconf schema file")
|
||||||
parser.add_option("-s", "--simple", action="store_true", dest="simple",
|
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.'
|
print >> sys.stderr, 'Too many output formats requested.'
|
||||||
return 1
|
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:
|
if not options.gconf and options.schema_id:
|
||||||
print >> sys.stderr, 'Default schema ID can only be specified when converting a gconf schema.'
|
print >> sys.stderr, 'Default schema ID can only be specified when converting a gconf schema.'
|
||||||
return 1
|
return 1
|
||||||
@ -1010,7 +1020,7 @@ def main(args):
|
|||||||
options.simple = True
|
options.simple = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
parser = GConfSchemaParser(argfile, options.schema_id)
|
parser = GConfSchemaParser(argfile, options.gettext_domain, options.schema_id)
|
||||||
schema_root = parser.parse()
|
schema_root = parser.parse()
|
||||||
except SyntaxError, e:
|
except SyntaxError, e:
|
||||||
raise GSettingsSchemaConvertException('\'%s\' does not look like a valid gconf schema file: %s' % (argfile, e))
|
raise GSettingsSchemaConvertException('\'%s\' does not look like a valid gconf schema file: %s' % (argfile, e))
|
||||||
|
Loading…
Reference in New Issue
Block a user