make_locales from config_get

This commit is contained in:
Enno Rehling 2017-02-12 05:52:46 +01:00
parent e5c95f1501
commit 17ff2ead41
4 changed files with 7 additions and 11 deletions

2
clibs

@ -1 +1 @@
Subproject commit 27c8b3202b52766465743c3324fc0b52c5ba4b11
Subproject commit f91ef37f08c5244bf616f1836c0aa9caaf36805c

View File

@ -66,10 +66,6 @@ static void xml_readtext(xmlNodePtr node, struct locale **lang, xmlChar ** text)
xmlChar *propValue = xmlGetProp(node, BAD_CAST "locale");
assert(propValue != NULL);
*lang = get_locale((const char *)propValue);
#ifdef MAKE_LOCALES
if (*lang == NULL)
*lang = get_or_create_locale((const char *)propValue);
#endif
xmlFree(propValue);
*text = xmlNodeListGetString(node->doc, node->children, 1);

View File

@ -70,15 +70,13 @@ static void load_inifile(dictionary * d)
lomem = iniparser_getint(d, "game:lomem", lomem) ? 1 : 0;
verbosity = iniparser_getint(d, "game:verbose", 2);
str = iniparser_getstring(d, "game:locales", "de,en");
make_locales(str);
}
static dictionary *parse_config(const char *filename)
{
char path[MAX_PATH];
dictionary *d;
const char *cfgpath = config_get("config.path");
const char *str, *cfgpath = config_get("config.path");
if (cfgpath) {
join_path(cfgpath, filename, path, sizeof(path));
@ -99,6 +97,8 @@ static dictionary *parse_config(const char *filename)
gm_codepage = iniparser_getint(d, "editor:codepage", gm_codepage);
#endif
}
str = config_get("game.locales");
make_locales(str ? str : "de,en");
return d;
}

View File

@ -327,10 +327,10 @@ static int locale_init = 0;
void init_locales(void)
{
int l;
locale * lang;
if (locale_init) return;
for (l = 0; localenames[l]; ++l) {
struct locale *lang = get_or_create_locale(localenames[l]);
assert(locales);
for (lang = locales; lang; lang = lang->next) {
init_locale(lang);
}
locale_init = 1;