Inherit gettext-domain from <schemalist>

When the <schema> doesn't have a 'gettext-domain' attribute, but
the <schemalist> does, use that one.

Bug #635640.
This commit is contained in:
Christian Persch 2010-11-26 21:05:20 +01:00
parent 69129e8065
commit 57143e311d
4 changed files with 15 additions and 2 deletions

View File

@ -1228,7 +1228,9 @@ start_element (GMarkupParseContext *context,
OPTIONAL | STRING, "gettext-domain", &gettext_domain,
OPTIONAL | STRING, "extends", &extends,
OPTIONAL | STRING, "list-of", &list_of))
parse_state_start_schema (state, id, path, gettext_domain,
parse_state_start_schema (state, id, path,
gettext_domain ? gettext_domain
: state->schemalist_domain,
extends, list_of, error);
return;
}

View File

@ -374,6 +374,7 @@ schema_tests = \
schema-tests/extending.gschema.xml \
schema-tests/from-docs.gschema.xml \
schema-tests/incomplete-list.gschema.xml \
schema-tests/inherit-gettext-domain.gschema.xml \
schema-tests/invalid-path.gschema.xml \
schema-tests/key-in-list-indirect.gschema.xml \
schema-tests/key-in-list.gschema.xml \

View File

@ -117,9 +117,11 @@ static const SchemaTest tests[] = {
{ "flags-bad-default", NULL, "*<default> * not in the specified flags type*" },
{ "flags-more-than-one-bit", NULL, "*flags values must have at most 1 bit set*" },
{ "flags-with-enum-attr", NULL, "*<enum id='flags'> not (yet) defined*" },
{ "flags-with-enum-tag", NULL, "*<flags id='flags'> not (yet) defined*" }
{ "flags-with-enum-tag", NULL, "*<flags id='flags'> not (yet) defined*" },
{ "inherit-gettext-domain", NULL, NULL }
};
int
main (int argc, char *argv[])
{

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist gettext-domain="foo">
<schema id="bar">
<key name="baz" type="s">
<default l10n="messages" context="foobar">'value'</default>
</key>
</schema>
</schemalist>