forked from github/server
- crash nr_section when message doesn't have a text.
- fixed message without text
This commit is contained in:
parent
b132ffdd2b
commit
3a01120784
2 changed files with 20 additions and 14 deletions
|
@ -54,9 +54,13 @@ nrt_find(const struct locale * lang, const struct message_type * mtype)
|
||||||
}
|
}
|
||||||
type = type->next;
|
type = type->next;
|
||||||
}
|
}
|
||||||
|
if (!found) {
|
||||||
|
log_warning(("could not find nr-type %s for locale %s\n",
|
||||||
|
mtype->name, locale_name(lang)));
|
||||||
|
}
|
||||||
if (lang && found && found->lang!=lang) {
|
if (lang && found && found->lang!=lang) {
|
||||||
log_warning(("could not find nr-type %s for locale %s, substituting with %s\n",
|
log_warning(("could not find nr-type %s for locale %s, using %s\n",
|
||||||
mtype->name, locale_name(lang), locale_name(found->lang)));
|
mtype->name, locale_name(lang), locale_name(found->lang)));
|
||||||
}
|
}
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
@ -151,18 +155,18 @@ int
|
||||||
nr_level(const struct message *msg)
|
nr_level(const struct message *msg)
|
||||||
{
|
{
|
||||||
nrmessage_type * nrt = nrt_find(NULL, msg->type);
|
nrmessage_type * nrt = nrt_find(NULL, msg->type);
|
||||||
return nrt->level;
|
return nrt?nrt->level:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
nr_section(const struct message *msg)
|
nr_section(const struct message *msg)
|
||||||
{
|
{
|
||||||
nrmessage_type * nrt = nrt_find(default_locale, msg->type);
|
nrmessage_type * nrt = nrt_find(default_locale, msg->type);
|
||||||
return nrt->section;
|
return nrt?nrt->section:NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
nrt_section(const nrmessage_type * nrt)
|
nrt_section(const nrmessage_type * nrt)
|
||||||
{
|
{
|
||||||
return nrt->section;
|
return nrt?nrt->section:NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,16 @@
|
||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<messages>
|
<messages>
|
||||||
|
<message name="give" section="economy">
|
||||||
|
<type>
|
||||||
|
<arg name="unit" type="unit"/>
|
||||||
|
<arg name="amount" type="int"/>
|
||||||
|
<arg name="resource" type="resource"/>
|
||||||
|
<arg name="target" type="unit"/>
|
||||||
|
</type>
|
||||||
|
<text locale="de">"$unit($unit) übergibt $int($amount) $resource($resource,$amount) an $unit($target)."</text>
|
||||||
|
<text locale="en">"$unit($unit) gives $int($amount) $resource($resource,$amount) to $unit($target)."</text>
|
||||||
|
</message>
|
||||||
|
|
||||||
<message name="nr_claims" section="nr">
|
<message name="nr_claims" section="nr">
|
||||||
<type>
|
<type>
|
||||||
<arg name="items" type="items"/>
|
<arg name="items" type="items"/>
|
||||||
|
@ -6986,15 +6997,6 @@
|
||||||
<text locale="en">"$unit($unit) transfers $int($amount) person$if($eq($amount,1),"","s") to the local peasants."</text>
|
<text locale="en">"$unit($unit) transfers $int($amount) person$if($eq($amount,1),"","s") to the local peasants."</text>
|
||||||
</message>
|
</message>
|
||||||
|
|
||||||
<message name="give" section="economy">
|
|
||||||
<type>
|
|
||||||
<arg name="unit" type="unit"/>
|
|
||||||
<arg name="amount" type="int"/>
|
|
||||||
<arg name="resource" type="resource"/>
|
|
||||||
<arg name="target" type="unit"/>
|
|
||||||
</type>
|
|
||||||
</message>
|
|
||||||
|
|
||||||
<message name="give_peasants" section="economy">
|
<message name="give_peasants" section="economy">
|
||||||
<type>
|
<type>
|
||||||
<arg name="unit" type="unit"/>
|
<arg name="unit" type="unit"/>
|
||||||
|
|
Loading…
Reference in a new issue