diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 6a59bf921..a328d9a69 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -194,7 +194,7 @@ print_curses(FILE * F, void * obj, typ_t typ, attrib *a, int self) header = 1; fputs("EFFECTS\n", F); } - fprintf(F, "\"%d %s\"\n", data->value, add_translation(key, locale_string(NULL, key))); + fprintf(F, "\"%d %s\"\n", data->value, add_translation(key, locale_string(default_locale, key))); } a = a->next; } diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index a1ae48a6a..94367927f 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -1682,13 +1682,13 @@ attack_message(const troop at, const troop dt, const weapon * wp, int dist) if (dist > 1) { sprintf(smallbuf, "%s schießt mit %s auf %s", a_unit, - locale_string(NULL, resourcename(wp->type->itype->rtype, GR_INDEFINITE_ARTICLE)), d_unit); + locale_string(default_locale, resourcename(wp->type->itype->rtype, GR_INDEFINITE_ARTICLE)), d_unit); return smallbuf; } sprintf(smallbuf, "%s schlägt mit %s nach %s", a_unit, - locale_string(NULL, resourcename(wp->type->itype->rtype, GR_INDEFINITE_ARTICLE)), d_unit); + locale_string(default_locale, resourcename(wp->type->itype->rtype, GR_INDEFINITE_ARTICLE)), d_unit); return smallbuf; } @@ -1731,11 +1731,11 @@ hits(troop at, troop dt, weapon * awp) sprintf(debugbuf, "%.4s/%d [%6s/%d] attackiert %.4s/%d [%6s/%d] mit %d dist %d", unitid(au), at.index, (awp != NULL) ? - locale_string(NULL, resourcename(awp->type->itype->rtype, 0)) : "unbewaffnet", + locale_string(default_locale, resourcename(awp->type->itype->rtype, 0)) : "unbewaffnet", weapon_effskill(at, dt, awp, true, dist>1), unitid(du), dt.index, (dwp != NULL) ? - locale_string(NULL, resourcename(dwp->type->itype->rtype, 0)) : "unbewaffnet", + locale_string(default_locale, resourcename(dwp->type->itype->rtype, 0)) : "unbewaffnet", weapon_effskill(dt, at, dwp, true, dist>1), skdiff, dist); if (b->small) { @@ -2494,7 +2494,7 @@ aftermath(battle * b) for (l=df->loot; l; l=l->next) { const item_type * itype = l->type; sprintf(buf, "%s erbeute%s %d %s.", unitname(du), du->number==1?"t":"n", - l->number, locale_string(NULL, resourcename(itype->rtype, l->number!=1))); + l->number, locale_string(default_locale, resourcename(itype->rtype, l->number!=1))); fbattlerecord(du->faction, r, buf); i_change(&du->items, itype, l->number); } diff --git a/src/common/kernel/combatspells.c b/src/common/kernel/combatspells.c index 9abc6ae1a..28e253bab 100644 --- a/src/common/kernel/combatspells.c +++ b/src/common/kernel/combatspells.c @@ -1340,7 +1340,7 @@ sp_reanimate(fighter * fi, int level, int force, spell * sp) } if (get_item(mage, I_AMULET_OF_HEALING) > 0) { scat(" und benutzt das "); - scat(locale_string(NULL, resourcename(oldresourcetype[R_AMULET_OF_HEALING], 0))); + scat(locale_string(default_locale, resourcename(oldresourcetype[R_AMULET_OF_HEALING], 0))); scat(", um den Zauber zu verstärken"); k *= 2; c += 0.10; @@ -1421,7 +1421,7 @@ sp_healing(fighter * fi, int level, int force, spell * sp) if (get_item(mage, I_AMULET_OF_HEALING) > 0) { scat(" und benutzt das "); - scat(locale_string(NULL, resourcename(oldresourcetype[R_AMULET_OF_HEALING], 0))); + scat(locale_string(default_locale, resourcename(oldresourcetype[R_AMULET_OF_HEALING], 0))); scat(", um die Heilzauber zu verstärken"); healhp *= 2; } diff --git a/src/common/kernel/movement.c b/src/common/kernel/movement.c index 036fc1092..20087bcf1 100644 --- a/src/common/kernel/movement.c +++ b/src/common/kernel/movement.c @@ -1631,9 +1631,9 @@ sail(region * starting_point, unit * u, region * next_point, boolean move_on_lan icat(trans->number); scat(" "); if (itm->number == 1) { - scat(locale_string(NULL, resourcename(itm->type->rtype, 0))); + scat(locale_string(default_locale, resourcename(itm->type->rtype, 0))); } else { - scat(locale_string(NULL, resourcename(itm->type->rtype, NMF_PLURAL))); + scat(locale_string(default_locale, resourcename(itm->type->rtype, NMF_PLURAL))); } } scat(" von der "); diff --git a/src/common/kernel/region.c b/src/common/kernel/region.c index 333e19b7b..6cb4d52f7 100644 --- a/src/common/kernel/region.c +++ b/src/common/kernel/region.c @@ -932,6 +932,7 @@ r_addmessage(struct region * r, const struct faction * viewer, struct message * if (imsg==NULL) { imsg = malloc(sizeof(struct individual_message)); imsg->next = r->individual_messages; + imsg->msgs = NULL; r->individual_messages = imsg; imsg->viewer = viewer; } diff --git a/src/common/modules/arena.c b/src/common/modules/arena.c index 98f6d89f7..29d8bc7a5 100644 --- a/src/common/modules/arena.c +++ b/src/common/modules/arena.c @@ -420,7 +420,7 @@ caldera_handle(trigger * t, void * data) while (*ip) { item * i = *ip; char zText[10]; - sprintf(zText, " %d %s", i->number, locale_string(NULL, resourcename(i->type->rtype, i->number!=1))); + sprintf(zText, " %d %s", i->number, locale_string(default_locale, resourcename(i->type->rtype, i->number!=1))); strcat(buf, zText); i_remove(ip, i); if (*ip==i) ip=&i->next; diff --git a/src/common/util/language.c b/src/common/util/language.c index d69faf118..04dcdb699 100644 --- a/src/common/util/language.c +++ b/src/common/util/language.c @@ -38,8 +38,8 @@ struct locale { } * strings[SMAXHASH]; }; +locale * default_locale; static locale * locales; -static locale * default_locale; unsigned int locale_hashkey(const locale * lang) diff --git a/src/common/util/language.h b/src/common/util/language.h index 7b3d56ef5..741e005af 100644 --- a/src/common/util/language.h +++ b/src/common/util/language.h @@ -33,4 +33,6 @@ extern void debug_language(const char * log); #define LOC(s,l) locale_string(s, l) +extern locale * default_locale; + #endif diff --git a/src/common/util/nrmessage.c b/src/common/util/nrmessage.c index f455389dc..bbf78f045 100644 --- a/src/common/util/nrmessage.c +++ b/src/common/util/nrmessage.c @@ -17,6 +17,7 @@ /* util includes */ #include "log.h" #include "message.h" +#include "language.h" #include "translation.h" /* libc includes */ @@ -116,6 +117,6 @@ nr_level(const struct message *msg) const char * nr_section(const struct message *msg) { - nrmessage_type * nrt = nrt_find(NULL, msg->type); + nrmessage_type * nrt = nrt_find(default_locale, msg->type); return nrt->section; } diff --git a/src/res/de/messages.xml b/src/res/de/messages.xml index e6a606060..2b2b158aa 100644 --- a/src/res/de/messages.xml +++ b/src/res/de/messages.xml @@ -4059,7 +4059,7 @@ - + "$unit($unit) loses $int($dead) of $int($add($live,$dead)) people due to starvation in $region($region)." @@ -5148,7 +5148,7 @@ - + "$unit($unit) earns $int($amount)$if($eq($wanted,$amount),""," of $int($wanted)") in $region($region)." diff --git a/src/res/de/strings.txt b/src/res/de/strings.txt index 06b967c41..b8048ca4e 100644 --- a/src/res/de/strings.txt +++ b/src/res/de/strings.txt @@ -74,8 +74,6 @@ unknownunit;de;eine unbekannte Einheit ## Meldungssektionen section_events;de;Meldungen und Ereignisse section_errors;de;Warnungen und Fehler -section_event_p;de;Meldungen und Ereignisse -section_error_p;de;Warnungen und Fehler section_economy;de;Wirtschaft und Handel section_production;de;Rohstoffe und Produktion section_magic;de;Magie und Artefakte