forked from github/server
Merge branch 'nr_localization_fix' of https://github.com/stm2/server into stm2-nr_localization_fix
Conflicts: src/report.c
This commit is contained in:
commit
9a395127ac
|
@ -364,6 +364,43 @@
|
||||||
<text locale="de">und im </text>
|
<text locale="de">und im </text>
|
||||||
<text locale="en">and to the </text>
|
<text locale="en">and to the </text>
|
||||||
</string>
|
</string>
|
||||||
|
<string name="nr_schemes_prefix">
|
||||||
|
<text locale="de">Schemen der Regionen </text>
|
||||||
|
<text locale="en">Schemes of </text>
|
||||||
|
</string>
|
||||||
|
<string name="nr_schemes_postfix">
|
||||||
|
<text locale="de"> sind erkennbar.</text>
|
||||||
|
<text locale="en"> can be discerned.</text>
|
||||||
|
</string>
|
||||||
|
<string name="nr_borderlist_prefix">
|
||||||
|
<text locale="de">Im </text>
|
||||||
|
<text locale="en">To the </text>
|
||||||
|
</string>
|
||||||
|
<string name="nr_borderlist_lastfix">
|
||||||
|
<text locale="de"> und im </text>
|
||||||
|
<text locale="en">, and to the </text>
|
||||||
|
</string>
|
||||||
|
<string name="nr_borderlist_infix">
|
||||||
|
<text locale="de">, im </text>
|
||||||
|
<text locale="en">, to the </text>
|
||||||
|
</string>
|
||||||
|
<string name="nr_guarding_prefix">
|
||||||
|
<text locale="de">Die Region wird von </text>
|
||||||
|
<text locale="en">The region is guarded by </text>
|
||||||
|
</string>
|
||||||
|
<string name="nr_guarding_unknown">
|
||||||
|
<text locale="de">unbekannten Einheiten</text>
|
||||||
|
<text locale="en">unknown units</text>
|
||||||
|
</string>
|
||||||
|
<string name="nr_guarding_postfix">
|
||||||
|
<text locale="de"> bewacht.</text>
|
||||||
|
<text locale="en">.</text>
|
||||||
|
</string>
|
||||||
|
<string name="nr_building_inprogress">
|
||||||
|
<text locale="de"> (im Bau)</text>
|
||||||
|
<text locale="en"> (under construction)</text>
|
||||||
|
</string>
|
||||||
|
|
||||||
<string name="unitdefault">
|
<string name="unitdefault">
|
||||||
<text locale="de">Einheit</text>
|
<text locale="de">Einheit</text>
|
||||||
<text locale="en">Unit</text>
|
<text locale="en">Unit</text>
|
||||||
|
|
|
@ -924,6 +924,38 @@
|
||||||
<text locale="de">"Auf dem Markt wird $resource($p1,0) feilgeboten."</text>
|
<text locale="de">"Auf dem Markt wird $resource($p1,0) feilgeboten."</text>
|
||||||
<text locale="en">"The local market offers $resource($p1,0)."</text>
|
<text locale="en">"The local market offers $resource($p1,0)."</text>
|
||||||
</message>
|
</message>
|
||||||
|
<message name="nr_potion_effect" section="nr">
|
||||||
|
<type>
|
||||||
|
<arg name="potion" type="resource"/>
|
||||||
|
<arg name="left" type="int"/>
|
||||||
|
</type>
|
||||||
|
<text locale="de">"Auf der Einheit $if($eq($left,1),"liegt","liegen") $int($left) Wirkung$if($eq($left,1),"","en") $resource($potion,1)."</text>
|
||||||
|
<text locale="en">"There are $int($left) use($eq($left,1),"s","") of $resource($potion,1) left."</text>
|
||||||
|
</message>
|
||||||
|
<message name="nr_region_owner" section="nr">
|
||||||
|
<type>
|
||||||
|
<arg name="faction" type="faction"/>
|
||||||
|
</type>
|
||||||
|
<text locale="de">"Die Region ist im Besitz von $faction($faction)."</text>
|
||||||
|
<text locale="en">"The region is owned by $faction($faction)."</text>
|
||||||
|
</message>
|
||||||
|
<message name="nr_borderlist_postfix" section="nr">
|
||||||
|
<type>
|
||||||
|
<arg name="transparent" type="int"/>
|
||||||
|
<arg name="object" type="string"/>
|
||||||
|
</type>
|
||||||
|
<text locale="de">"$if($transparent," befindet sich"," versperrt") ${object} $if($transparent,""," die Sicht")."</text>
|
||||||
|
<text locale="en">"$if($transparent," there is"," sight is blocked by ") ${object}."</text>
|
||||||
|
</message>
|
||||||
|
<message name="nr_building_besieged" section="nr">
|
||||||
|
<type>
|
||||||
|
<arg name="soldiers" type="int"/>
|
||||||
|
<arg name="diff" type="int"/>
|
||||||
|
</type>
|
||||||
|
<text locale="de">", belagert von $int($soldiers) Personen$if($lt($diff,0),""," (abgeschnitten)")"</text>
|
||||||
|
<text locale="en">", besieged by $int($soldiers) soldiers$if($lt($diff,0),""," (cut off)")"</text>
|
||||||
|
</message>
|
||||||
|
|
||||||
<message name="newbie_password" section="events">
|
<message name="newbie_password" section="events">
|
||||||
<type>
|
<type>
|
||||||
<arg name="password" type="string"/>
|
<arg name="password" type="string"/>
|
||||||
|
|
117
src/report.c
117
src/report.c
|
@ -634,10 +634,10 @@ int indent)
|
||||||
|
|
||||||
for (; a; a = a->next) {
|
for (; a; a = a->next) {
|
||||||
char buf[4096];
|
char buf[4096];
|
||||||
|
message *msg;
|
||||||
|
|
||||||
if (fval(a->type, ATF_CURSE)) {
|
if (fval(a->type, ATF_CURSE)) {
|
||||||
curse *c = (curse *)a->data.v;
|
curse *c = (curse *)a->data.v;
|
||||||
message *msg;
|
|
||||||
|
|
||||||
if (c->type->cansee) {
|
if (c->type->cansee) {
|
||||||
self = c->type->cansee(viewer, obj, typ, c, self);
|
self = c->type->cansee(viewer, obj, typ, c, self);
|
||||||
|
@ -654,13 +654,11 @@ int indent)
|
||||||
else if (a->type == &at_effect && self) {
|
else if (a->type == &at_effect && self) {
|
||||||
effect_data *data = (effect_data *)a->data.v;
|
effect_data *data = (effect_data *)a->data.v;
|
||||||
if (data->value > 0) {
|
if (data->value > 0) {
|
||||||
sprintf(buf, "Auf der Einheit lieg%s %d Wirkung%s %s.",
|
msg = msg_message("nr_potion_effect", "potion left",
|
||||||
(data->value == 1 ? "t" : "en"),
|
data->type->itype->rtype, data->value);
|
||||||
data->value,
|
nr_render(msg, viewer->locale, buf, sizeof(buf), viewer);
|
||||||
(data->value == 1 ? "" : "en"),
|
|
||||||
LOC(default_locale, resourcename(data->type->itype->rtype, 0)));
|
|
||||||
rnl(F);
|
|
||||||
rparagraph(F, buf, indent, 2, 0);
|
rparagraph(F, buf, indent, 2, 0);
|
||||||
|
msg_release(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -826,7 +824,7 @@ static void prices(FILE * F, const region * r, const faction * f)
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
|
||||||
for (dmd = r->land->demands; dmd; dmd = dmd->next)
|
for (dmd = r->land->demands; dmd; dmd = dmd->next){
|
||||||
if (dmd->value > 0) {
|
if (dmd->value > 0) {
|
||||||
m = msg_message("nr_market_price", "product price",
|
m = msg_message("nr_market_price", "product price",
|
||||||
dmd->type->itype->rtype, dmd->value * dmd->type->price);
|
dmd->type->itype->rtype, dmd->value * dmd->type->price);
|
||||||
|
@ -836,23 +834,24 @@ static void prices(FILE * F, const region * r, const faction * f)
|
||||||
msg_release(m);
|
msg_release(m);
|
||||||
n--;
|
n--;
|
||||||
if (n == 0) {
|
if (n == 0) {
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_end"), size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_end"),
|
||||||
|
size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
} else if (n == 1) {
|
||||||
else if (n == 1) {
|
|
||||||
bytes = (int)strlcpy(bufp, " ", size);
|
bytes = (int)strlcpy(bufp, " ", size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_final"), size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_final"),
|
||||||
|
size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
bytes = (int)strlcpy(bufp, " ", size);
|
bytes = (int)strlcpy(bufp, " ", size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
} else {
|
||||||
else {
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_next"),
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_trade_next"), size);
|
size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
bytes = (int)strlcpy(bufp, " ", size);
|
bytes = (int)strlcpy(bufp, " ", size);
|
||||||
|
@ -860,6 +859,7 @@ static void prices(FILE * F, const region * r, const faction * f)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* Schreibe Paragraphen */
|
/* Schreibe Paragraphen */
|
||||||
*bufp = 0;
|
*bufp = 0;
|
||||||
|
@ -1099,10 +1099,12 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
||||||
|
|
||||||
if (rule_region_owners()) {
|
if (rule_region_owners()) {
|
||||||
const faction *owner = region_get_owner(r);
|
const faction *owner = region_get_owner(r);
|
||||||
|
message *msg;
|
||||||
|
|
||||||
if (owner != NULL) {
|
if (owner != NULL) {
|
||||||
// TODO: localization
|
msg = msg_message("nr_region_owner", "faction", owner);
|
||||||
bytes = _snprintf(bufp, size, " Die Region ist im Besitz von %s.",
|
bytes = (int)nr_render(msg, f->locale, bufp, size, f);
|
||||||
factionname(owner));
|
msg_release(msg);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
|
@ -1207,7 +1209,9 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
||||||
if (rl) {
|
if (rl) {
|
||||||
bufp = buf;
|
bufp = buf;
|
||||||
size = sizeof(buf) - 1;
|
size = sizeof(buf) - 1;
|
||||||
bytes = (int)strlcpy(bufp, "Schemen der Regionen ", size);
|
|
||||||
|
// this localization might not work for every language but is fine for de and en
|
||||||
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_schemes_prefix"), size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
rl2 = rl;
|
rl2 = rl;
|
||||||
|
@ -1222,7 +1226,7 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bytes = (int)strlcpy(bufp, " sind erkennbar.", size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_schemes_postfix"), size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
free_regionlist(rl);
|
free_regionlist(rl);
|
||||||
|
@ -1249,17 +1253,20 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
||||||
rnl(F);
|
rnl(F);
|
||||||
for (e = edges; e; e = e->next) {
|
for (e = edges; e; e = e->next) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
message *msg;
|
||||||
|
|
||||||
bufp = buf;
|
bufp = buf;
|
||||||
size = sizeof(buf) - 1;
|
size = sizeof(buf) - 1;
|
||||||
for (d = 0; d != MAXDIRECTIONS; ++d) {
|
for (d = 0; d != MAXDIRECTIONS; ++d) {
|
||||||
if (!e->exist[d])
|
if (!e->exist[d])
|
||||||
continue;
|
continue;
|
||||||
|
// this localization might not work for every language but is fine for de and en
|
||||||
if (first)
|
if (first)
|
||||||
bytes = (int)strlcpy(bufp, "Im ", size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_borderlist_prefix"), size);
|
||||||
else if (e->lastd == d)
|
else if (e->lastd == d)
|
||||||
bytes = (int)strlcpy(bufp, " und im ", size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_borderlist_lastfix"), size);
|
||||||
else
|
else
|
||||||
bytes = (int)strlcpy(bufp, ", im ", size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_borderlist_infix"), size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
bytes = (int)strlcpy(bufp, LOC(f->locale, directions[d]), size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, directions[d]), size);
|
||||||
|
@ -1267,21 +1274,14 @@ static void describe(FILE * F, const seen_region * sr, faction * f)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
if (!e->transparent)
|
// TODO name is localized? Works for roads anyway...
|
||||||
bytes = (int)strlcpy(bufp, " versperrt ", size);
|
msg = msg_message("nr_borderlist_postfix", "transparent object",
|
||||||
else
|
e->transparent, e->name);
|
||||||
bytes = (int)strlcpy(bufp, " befindet sich ", size);
|
bytes = (int)nr_render(msg, f->locale, bufp, size, f);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
msg_release(msg);
|
||||||
WARN_STATIC_BUFFER();
|
|
||||||
bytes = (int)strlcpy(bufp, e->name, size);
|
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
|
||||||
WARN_STATIC_BUFFER();
|
|
||||||
if (!e->transparent)
|
|
||||||
bytes = (int)strlcpy(bufp, " die Sicht.", size);
|
|
||||||
else
|
|
||||||
bytes = (int)strlcpy(bufp, ".", size);
|
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
|
||||||
*bufp = 0;
|
*bufp = 0;
|
||||||
rparagraph(F, buf, 0, 0, 0);
|
rparagraph(F, buf, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
@ -1420,15 +1420,17 @@ static void durchreisende(FILE * F, const region * r, const faction * f)
|
||||||
++counter;
|
++counter;
|
||||||
if (u->ship != NULL) {
|
if (u->ship != NULL) {
|
||||||
#ifdef GERMAN_FLUFF_ENABLED
|
#ifdef GERMAN_FLUFF_ENABLED
|
||||||
if (counter == 1) {
|
if (strcmp("de", f->locale->name)==0) {
|
||||||
bytes = (int)strlcpy(bufp, "Die ", size);
|
if (counter == 1) {
|
||||||
}
|
bytes = (int)strlcpy(bufp, "Die ", size);
|
||||||
else {
|
}
|
||||||
bytes = (int)strlcpy(bufp, "die ", size);
|
else {
|
||||||
}
|
bytes = (int)strlcpy(bufp, "die ", size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0) {
|
}
|
||||||
WARN_STATIC_BUFFER();
|
if (wrptr(&bufp, &size, bytes) != 0) {
|
||||||
break;
|
WARN_STATIC_BUFFER();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
bytes = (int)strlcpy(bufp, shipname(u->ship), size);
|
bytes = (int)strlcpy(bufp, shipname(u->ship), size);
|
||||||
|
@ -1827,7 +1829,7 @@ static void guards(FILE * F, const region * r, const faction * see)
|
||||||
size_t size = sizeof(buf) - 1;
|
size_t size = sizeof(buf) - 1;
|
||||||
int bytes;
|
int bytes;
|
||||||
|
|
||||||
bytes = (int)strlcpy(bufp, "Die Region wird von ", size);
|
bytes = (int)strlcpy(bufp, LOC(see->locale, "nr_guarding_prefix"), size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
|
|
||||||
|
@ -1846,12 +1848,12 @@ static void guards(FILE * F, const region * r, const faction * see)
|
||||||
bytes = (int)strlcpy(bufp, factionname(guardians[i]), size);
|
bytes = (int)strlcpy(bufp, factionname(guardians[i]), size);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
bytes = (int)strlcpy(bufp, "unbekannten Einheiten", size);
|
bytes = (int)strlcpy(bufp, LOC(see->locale, "nr_guarding_unknown"), size);
|
||||||
}
|
}
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
bytes = (int)strlcpy(bufp, " bewacht.", size);
|
bytes = (int)strlcpy(bufp, LOC(see->locale, "nr_guarding_postfix"), size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
rnl(F);
|
rnl(F);
|
||||||
|
@ -1984,6 +1986,7 @@ const faction * f)
|
||||||
const char *name, *bname, *billusion = NULL;
|
const char *name, *bname, *billusion = NULL;
|
||||||
const struct locale *lang = NULL;
|
const struct locale *lang = NULL;
|
||||||
char buffer[8192], *bufp = buffer;
|
char buffer[8192], *bufp = buffer;
|
||||||
|
message *msg;
|
||||||
size_t size = sizeof(buffer) - 1;
|
size_t size = sizeof(buffer) - 1;
|
||||||
|
|
||||||
rnl(F);
|
rnl(F);
|
||||||
|
@ -2014,26 +2017,18 @@ const faction * f)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->size < b->type->maxsize) {
|
if (b->size < b->type->maxsize) {
|
||||||
bytes = (int)strlcpy(bufp, " (im Bau)", size);
|
bytes = (int)strlcpy(bufp, LOC(f->locale, "nr_building_inprogress"), size);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->besieged > 0 && sr->mode >= see_lighthouse) {
|
if (b->besieged > 0 && sr->mode >= see_lighthouse) {
|
||||||
bytes = (int)strlcpy(bufp, ", belagert von ", size);
|
msg = msg_message("nr_building_besieged", "soldiers diff", b->besieged,
|
||||||
|
b->besieged - b->size * SIEGEFACTOR);
|
||||||
|
bytes = (int)nr_render(msg, f->locale, bufp, size, f);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
if (wrptr(&bufp, &size, bytes) != 0)
|
||||||
WARN_STATIC_BUFFER();
|
WARN_STATIC_BUFFER();
|
||||||
bytes = (int)strlcpy(bufp, itoa10(b->besieged), size);
|
msg_release(msg);
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
|
||||||
WARN_STATIC_BUFFER();
|
|
||||||
bytes = (int)strlcpy(bufp, " Personen ", size);
|
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
|
||||||
WARN_STATIC_BUFFER();
|
|
||||||
if (b->besieged >= b->size * SIEGEFACTOR) {
|
|
||||||
bytes = (int)strlcpy(bufp, "(abgeschnitten)", size);
|
|
||||||
if (wrptr(&bufp, &size, bytes) != 0)
|
|
||||||
WARN_STATIC_BUFFER();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
i = 0;
|
i = 0;
|
||||||
if (b->display && b->display[0]) {
|
if (b->display && b->display[0]) {
|
||||||
|
|
Loading…
Reference in New Issue