void i18n_init(void) { prop_t *s = settings_add_dir(NULL, _p("Languages"), NULL, NULL, _p("Preferred languages")); setting_t *x; int i; htsmsg_t *store = htsmsg_store_load("i18n"); if(store == NULL) store = htsmsg_create_map(); nls_init(s, store); settings_create_info(s, NULL, _p("Language codes should be configured as three character ISO codes, example (eng, swe, fra)")); settings_create_string(s, "audio1", _p("Primary audio language code"), NULL, store, set_lang, &lang_audio[0], SETTINGS_INITIAL_UPDATE, NULL, settings_generic_save_settings, (void *)"i18n"); settings_create_string(s, "audio2", _p("Secondary audio language code"), NULL, store, set_lang, &lang_audio[1], SETTINGS_INITIAL_UPDATE, NULL, settings_generic_save_settings, (void *)"i18n"); settings_create_string(s, "audio3", _p("Tertiary audio language code"), NULL, store, set_lang, &lang_audio[2], SETTINGS_INITIAL_UPDATE, NULL, settings_generic_save_settings, (void *)"i18n"); settings_create_string(s, "subtitle1", _p("Primary subtitle language code"), NULL, store, set_lang, &lang_subtitle[0], SETTINGS_INITIAL_UPDATE, NULL, settings_generic_save_settings, (void *)"i18n"); settings_create_string(s, "subtitle2", _p("Secondary subtitle language code"), NULL, store, set_lang, &lang_subtitle[1], SETTINGS_INITIAL_UPDATE, NULL, settings_generic_save_settings, (void *)"i18n"); settings_create_string(s, "subtitle3", _p("Tertiary subtitle language code"), NULL, store, set_lang, &lang_subtitle[2], SETTINGS_INITIAL_UPDATE, NULL, settings_generic_save_settings, (void *)"i18n"); x = settings_create_multiopt(s, "srt_charset", _p("SRT character set")); const charset_t *cs; for(i = 0; (cs = charset_get_idx(i)) != NULL; i++) settings_multiopt_add_opt_cstr(x, cs->id, cs->title, i == 0); settings_multiopt_initiate(x, set_srt_charset, NULL, NULL, store, settings_generic_save_settings, (void *)"i18n"); }
void i18n_init(void) { prop_t *s = settings_add_dir(NULL, _p("Languages"), "i18n", NULL, _p("Preferred languages"), "settings:i18n"); int i; nls_init(s); #ifdef STOS setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Timezone")), SETTING_CALLBACK(set_timezone, NULL), SETTING_STORE("i18n", "timezone"), NULL); #endif setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Time format")), SETTING_STORE("i18n", "timeformat"), SETTING_WRITE_INT(&gconf.time_format), SETTING_OPTION(gconf.time_format_system ? "0" : NULL, _p("System default")), SETTING_OPTION("1", _p("24 Hour")), SETTING_OPTION("2", _p("12 Hour")), NULL); settings_create_info(s, NULL, _p("Language codes should be configured as three character ISO codes, example (eng, swe, fra)")); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Primary audio language code")), SETTING_CALLBACK(set_lang, &lang_audio[0]), SETTING_STORE("i18n", "audio1"), NULL); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Secondary audio language code")), SETTING_CALLBACK(set_lang, &lang_audio[1]), SETTING_STORE("i18n", "audio2"), NULL); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Tertiary audio language code")), SETTING_CALLBACK(set_lang, &lang_audio[2]), SETTING_STORE("i18n", "audio3"), NULL); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Primary subtitle language code")), SETTING_CALLBACK(&set_lang, &lang_subtitle[0]), SETTING_STORE("i18n", "subtitle1"), NULL); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Secondary subtitle language code")), SETTING_CALLBACK(&set_lang, &lang_subtitle[1]), SETTING_STORE("i18n", "subtitle2"), NULL); setting_create(SETTING_STRING, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Tertiary subtitle language code")), SETTING_CALLBACK(&set_lang, &lang_subtitle[2]), SETTING_STORE("i18n", "subtitle3"), NULL); const char **optlist = NULL; const charset_t *cs; for(i = 0; (cs = charset_get_idx(i)) != NULL; i++) {} optlist = alloca((i * 2 + 3) * sizeof(const char *)); optlist[0] = "auto"; optlist[1] = "Auto"; for(i = 0; (cs = charset_get_idx(i)) != NULL; i++) { optlist[i * 2 + 2] = cs->id; optlist[i * 2 + 3] = cs->title; } optlist[i * 2 + 2] = NULL; setting_create(SETTING_MULTIOPT, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Default character set")), SETTING_STORE("i18n", "default_charset"), SETTING_CALLBACK(set_default_charset, NULL), SETTING_OPTION_LIST(optlist), NULL); setting_create(SETTING_BOOL, s, SETTINGS_INITIAL_UPDATE, SETTING_TITLE(_p("Ignore 'The' at beginning of words when sorting")), SETTING_STORE("i18n", "skipthe"), SETTING_WRITE_BOOL(&gconf.ignore_the_prefix), NULL); }