i18n of themes
This commit is contained in:
parent
383208328c
commit
ddd18c32a9
|
@ -89,7 +89,7 @@ static char *game_name(const char *path, const char *d_name)
|
||||||
char *p = getfilepath(path, MAIN_FILE);
|
char *p = getfilepath(path, MAIN_FILE);
|
||||||
if (!p)
|
if (!p)
|
||||||
goto err;
|
goto err;
|
||||||
l = lookup_tag(p, "$Name:", "--");
|
l = lookup_tag(p, "Name", "--");
|
||||||
free(p);
|
free(p);
|
||||||
if (l)
|
if (l)
|
||||||
return l;
|
return l;
|
||||||
|
@ -534,8 +534,6 @@ int game_init(const char *name)
|
||||||
{
|
{
|
||||||
getcwd(game_cwd, sizeof(game_cwd));
|
getcwd(game_cwd, sizeof(game_cwd));
|
||||||
|
|
||||||
if (!opt_lang || !opt_lang[0])
|
|
||||||
opt_lang = game_locale();
|
|
||||||
if (menu_lang_select(opt_lang) && menu_lang_select(LANG_DEF)) {
|
if (menu_lang_select(opt_lang) && menu_lang_select(LANG_DEF)) {
|
||||||
fprintf(stderr, "Can not load default language.\n");
|
fprintf(stderr, "Can not load default language.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -87,6 +87,11 @@ int main(int argc, char **argv)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cfg_load();
|
||||||
|
|
||||||
|
if (!opt_lang || !opt_lang[0])
|
||||||
|
opt_lang = game_locale();
|
||||||
|
|
||||||
if (games_sw)
|
if (games_sw)
|
||||||
games_lookup(games_sw);
|
games_lookup(games_sw);
|
||||||
|
|
||||||
|
@ -99,8 +104,6 @@ int main(int argc, char **argv)
|
||||||
themes_lookup(game_local_themes_path());
|
themes_lookup(game_local_themes_path());
|
||||||
games_lookup(game_local_games_path());
|
games_lookup(game_local_games_path());
|
||||||
|
|
||||||
cfg_load();
|
|
||||||
|
|
||||||
if (noauto_sw)
|
if (noauto_sw)
|
||||||
opt_autosave = 0;
|
opt_autosave = 0;
|
||||||
if (window_sw)
|
if (window_sw)
|
||||||
|
|
|
@ -49,7 +49,7 @@ static char *slot_name(const char *path)
|
||||||
struct stat st;
|
struct stat st;
|
||||||
char *l;
|
char *l;
|
||||||
FILE *fd;
|
FILE *fd;
|
||||||
l = lookup_tag(path, "$Name:", "--");
|
l = lookup_tag(path, "Name", "--");
|
||||||
if (l) {
|
if (l) {
|
||||||
char *s = fromgame(l);
|
char *s = fromgame(l);
|
||||||
free(l);
|
free(l);
|
||||||
|
@ -616,7 +616,7 @@ static char *lang_code(const char *str)
|
||||||
static char *lang_name(const char *path, const char *file)
|
static char *lang_name(const char *path, const char *file)
|
||||||
{
|
{
|
||||||
char *l;
|
char *l;
|
||||||
l = lookup_tag(path, "$Name:", ";");
|
l = lookup_tag(path, "Name", ";");
|
||||||
if (l)
|
if (l)
|
||||||
return l;
|
return l;
|
||||||
return lang_code(file);
|
return lang_code(file);
|
||||||
|
|
|
@ -263,12 +263,10 @@ char *lookup_lang_tag(const char *fname, const char *tag, const char *comm)
|
||||||
{
|
{
|
||||||
char lang_tag[1024];
|
char lang_tag[1024];
|
||||||
char *l;
|
char *l;
|
||||||
snprintf(lang_tag, sizeof(lang_tag), "$%s(%s):", tag, opt_lang);
|
snprintf(lang_tag, sizeof(lang_tag), "%s(%s)", tag, opt_lang);
|
||||||
l = lookup_tag(fname, lang_tag, comm);
|
l = lookup_tag(fname, lang_tag, comm);
|
||||||
if (!l) {
|
if (!l)
|
||||||
snprintf(lang_tag, sizeof(lang_tag), "$%s:", tag);
|
l = lookup_tag(fname, tag, comm);
|
||||||
l = lookup_tag(fname, lang_tag, comm);
|
|
||||||
}
|
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,15 +274,17 @@ char *parse_tag(char *line, const char *tag, const char *comm, int *brk)
|
||||||
{
|
{
|
||||||
char *l = line;
|
char *l = line;
|
||||||
char *ns = NULL;
|
char *ns = NULL;
|
||||||
|
char ftag[1024];
|
||||||
|
snprintf(ftag, sizeof(ftag), "$%s:", tag);
|
||||||
l += strspn(l, " \t");
|
l += strspn(l, " \t");
|
||||||
if (strncmp(l, comm, strlen(comm))) { /* non coment block */
|
if (strncmp(l, comm, strlen(comm))) { /* non coment block */
|
||||||
*brk = 1;
|
*brk = 1;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
l += strlen(comm); l += strspn(l, " \t");
|
l += strlen(comm); l += strspn(l, " \t");
|
||||||
if (strncmp(l, tag, strlen(tag)))
|
if (strncmp(l, ftag, strlen(ftag)))
|
||||||
return NULL;
|
return NULL;
|
||||||
l += strlen(tag);
|
l += strlen(ftag);
|
||||||
l += strspn(l, " \t");
|
l += strspn(l, " \t");
|
||||||
ns = l;
|
ns = l;
|
||||||
l = find_in_esc(l, "\\$");
|
l = find_in_esc(l, "\\$");
|
||||||
|
|
Loading…
Reference in a new issue