forked from github/server
fix missing locales initialization
This commit is contained in:
parent
a9f0538d8e
commit
acbef7a3a0
|
@ -1899,7 +1899,6 @@ static void init_locale(const struct locale *lang)
|
||||||
|
|
||||||
init_translations(lang, UT_PARAMS, parameter_key, MAXPARAMS);
|
init_translations(lang, UT_PARAMS, parameter_key, MAXPARAMS);
|
||||||
init_translations(lang, UT_SKILLS, skill_key, MAXSKILLS);
|
init_translations(lang, UT_SKILLS, skill_key, MAXSKILLS);
|
||||||
// init_translations(lang, UT_KEYWORDS, keyword_key, MAXKEYWORDS);
|
|
||||||
|
|
||||||
tokens = get_translations(lang, UT_OPTIONS);
|
tokens = get_translations(lang, UT_OPTIONS);
|
||||||
for (i = 0; i != MAXOPTIONS; ++i) {
|
for (i = 0; i != MAXOPTIONS; ++i) {
|
||||||
|
|
|
@ -203,7 +203,7 @@ void json_terrains(cJSON *json) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (child=json->child;child;child=child->next) {
|
for (child=json->child;child;child=child->next) {
|
||||||
json_terrain(child, terrain_get_or_create(child->string));
|
json_terrain(child, get_or_create_terrain(child->string));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -601,7 +601,8 @@ bufunit(const faction * f, const unit * u, int indent, int mode, char *buf,
|
||||||
/* status */
|
/* status */
|
||||||
|
|
||||||
if (u->number && (u->faction == f || telepath_see || isbattle)) {
|
if (u->number && (u->faction == f || telepath_see || isbattle)) {
|
||||||
const char *c = locale_string(f->locale, hp_status(u));
|
const char *c = hp_status(u);
|
||||||
|
c = c ? locale_string(f->locale, c) : 0;
|
||||||
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();
|
||||||
|
|
|
@ -105,7 +105,7 @@ const terrain_type *get_terrain(const char *name) {
|
||||||
return terrain_find_i(name);
|
return terrain_find_i(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
terrain_type * terrain_get_or_create(const char *name) {
|
terrain_type * get_or_create_terrain(const char *name) {
|
||||||
terrain_type *terrain = terrain_find_i(name);
|
terrain_type *terrain = terrain_find_i(name);
|
||||||
if (!terrain) {
|
if (!terrain) {
|
||||||
terrain = (terrain_type *)calloc(sizeof(terrain_type), 1);
|
terrain = (terrain_type *)calloc(sizeof(terrain_type), 1);
|
||||||
|
|
|
@ -70,7 +70,7 @@ extern "C" {
|
||||||
struct terrain_type *next;
|
struct terrain_type *next;
|
||||||
} terrain_type;
|
} terrain_type;
|
||||||
|
|
||||||
extern terrain_type *terrain_get_or_create(const char *name);
|
extern terrain_type *get_or_create_terrain(const char *name);
|
||||||
extern const terrain_type *terrains(void);
|
extern const terrain_type *terrains(void);
|
||||||
extern const terrain_type *get_terrain(const char *name);
|
extern const terrain_type *get_terrain(const char *name);
|
||||||
extern const char *terrain_name(const struct region *r);
|
extern const char *terrain_name(const struct region *r);
|
||||||
|
|
|
@ -14,10 +14,10 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include "xmlreader.h"
|
#include "xmlreader.h"
|
||||||
|
|
||||||
/* kernel includes */
|
|
||||||
#include "building.h"
|
#include "building.h"
|
||||||
#include "equipment.h"
|
#include "equipment.h"
|
||||||
#include "item.h"
|
#include "item.h"
|
||||||
|
#include "keyword.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "race.h"
|
#include "race.h"
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
|
@ -1950,14 +1950,14 @@ static int parse_terrains(xmlDocPtr doc)
|
||||||
nodes = terrains->nodesetval;
|
nodes = terrains->nodesetval;
|
||||||
for (i = 0; i != nodes->nodeNr; ++i) {
|
for (i = 0; i != nodes->nodeNr; ++i) {
|
||||||
xmlNodePtr node = nodes->nodeTab[i];
|
xmlNodePtr node = nodes->nodeTab[i];
|
||||||
terrain_type *terrain = calloc(1, sizeof(terrain_type));
|
terrain_type *terrain;
|
||||||
xmlChar *propValue;
|
xmlChar *propValue;
|
||||||
xmlXPathObjectPtr xpathChildren;
|
xmlXPathObjectPtr xpathChildren;
|
||||||
xmlNodeSetPtr children;
|
xmlNodeSetPtr children;
|
||||||
|
|
||||||
propValue = xmlGetProp(node, BAD_CAST "name");
|
propValue = xmlGetProp(node, BAD_CAST "name");
|
||||||
assert(propValue != NULL);
|
assert(propValue != NULL);
|
||||||
terrain->_name = _strdup((const char *)propValue);
|
terrain = get_or_create_terrain((const char *)propValue);
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
|
|
||||||
terrain->max_road = (short)xml_ivalue(node, "road", 0);
|
terrain->max_road = (short)xml_ivalue(node, "road", 0);
|
||||||
|
@ -2053,7 +2053,6 @@ static int parse_terrains(xmlDocPtr doc)
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(xpathChildren);
|
xmlXPathFreeObject(xpathChildren);
|
||||||
|
|
||||||
register_terrain(terrain);
|
|
||||||
}
|
}
|
||||||
xmlXPathFreeObject(terrains);
|
xmlXPathFreeObject(terrains);
|
||||||
|
|
||||||
|
@ -2226,6 +2225,7 @@ static int parse_strings(xmlDocPtr doc)
|
||||||
xmlXPathFreeObject(strings);
|
xmlXPathFreeObject(strings);
|
||||||
|
|
||||||
xmlXPathFreeContext(xpath);
|
xmlXPathFreeContext(xpath);
|
||||||
|
init_locales();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ void test_cleanup(void)
|
||||||
terrain_type *
|
terrain_type *
|
||||||
test_create_terrain(const char * name, unsigned int flags)
|
test_create_terrain(const char * name, unsigned int flags)
|
||||||
{
|
{
|
||||||
terrain_type * t = terrain_get_or_create(name);
|
terrain_type * t = get_or_create_terrain(name);
|
||||||
t->_name = _strdup(name);
|
t->_name = _strdup(name);
|
||||||
t->flags = flags;
|
t->flags = flags;
|
||||||
return t;
|
return t;
|
||||||
|
|
Loading…
Reference in New Issue