forked from github/server
make_locales from config_get
This commit is contained in:
parent
e5c95f1501
commit
17ff2ead41
4 changed files with 7 additions and 11 deletions
2
clibs
2
clibs
|
@ -1 +1 @@
|
||||||
Subproject commit 27c8b3202b52766465743c3324fc0b52c5ba4b11
|
Subproject commit f91ef37f08c5244bf616f1836c0aa9caaf36805c
|
|
@ -66,10 +66,6 @@ static void xml_readtext(xmlNodePtr node, struct locale **lang, xmlChar ** text)
|
||||||
xmlChar *propValue = xmlGetProp(node, BAD_CAST "locale");
|
xmlChar *propValue = xmlGetProp(node, BAD_CAST "locale");
|
||||||
assert(propValue != NULL);
|
assert(propValue != NULL);
|
||||||
*lang = get_locale((const char *)propValue);
|
*lang = get_locale((const char *)propValue);
|
||||||
#ifdef MAKE_LOCALES
|
|
||||||
if (*lang == NULL)
|
|
||||||
*lang = get_or_create_locale((const char *)propValue);
|
|
||||||
#endif
|
|
||||||
xmlFree(propValue);
|
xmlFree(propValue);
|
||||||
|
|
||||||
*text = xmlNodeListGetString(node->doc, node->children, 1);
|
*text = xmlNodeListGetString(node->doc, node->children, 1);
|
||||||
|
|
|
@ -70,15 +70,13 @@ static void load_inifile(dictionary * d)
|
||||||
lomem = iniparser_getint(d, "game:lomem", lomem) ? 1 : 0;
|
lomem = iniparser_getint(d, "game:lomem", lomem) ? 1 : 0;
|
||||||
|
|
||||||
verbosity = iniparser_getint(d, "game:verbose", 2);
|
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)
|
static dictionary *parse_config(const char *filename)
|
||||||
{
|
{
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
dictionary *d;
|
dictionary *d;
|
||||||
const char *cfgpath = config_get("config.path");
|
const char *str, *cfgpath = config_get("config.path");
|
||||||
|
|
||||||
if (cfgpath) {
|
if (cfgpath) {
|
||||||
join_path(cfgpath, filename, path, sizeof(path));
|
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);
|
gm_codepage = iniparser_getint(d, "editor:codepage", gm_codepage);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
str = config_get("game.locales");
|
||||||
|
make_locales(str ? str : "de,en");
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -327,10 +327,10 @@ static int locale_init = 0;
|
||||||
|
|
||||||
void init_locales(void)
|
void init_locales(void)
|
||||||
{
|
{
|
||||||
int l;
|
locale * lang;
|
||||||
if (locale_init) return;
|
if (locale_init) return;
|
||||||
for (l = 0; localenames[l]; ++l) {
|
assert(locales);
|
||||||
struct locale *lang = get_or_create_locale(localenames[l]);
|
for (lang = locales; lang; lang = lang->next) {
|
||||||
init_locale(lang);
|
init_locale(lang);
|
||||||
}
|
}
|
||||||
locale_init = 1;
|
locale_init = 1;
|
||||||
|
|
Loading…
Reference in a new issue