summaryrefslogtreecommitdiffstats
path: root/ui/rccnames.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-12 03:55:23 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2005-07-12 03:55:23 +0000
commite598a2372179812389a702b78d5f8537eb6827d9 (patch)
treefad90d39ca5781d5ffdf4e9131050fe79d3e5383 /ui/rccnames.c
parent6b44784148735f594ac862abcd38c50c5d556df0 (diff)
downloadlibrcc-e598a2372179812389a702b78d5f8537eb6827d9.tar.gz
librcc-e598a2372179812389a702b78d5f8537eb6827d9.tar.bz2
librcc-e598a2372179812389a702b78d5f8537eb6827d9.tar.xz
librcc-e598a2372179812389a702b78d5f8537eb6827d9.zip
Language and Option Names
Diffstat (limited to 'ui/rccnames.c')
-rw-r--r--ui/rccnames.c107
1 files changed, 87 insertions, 20 deletions
diff --git a/ui/rccnames.c b/ui/rccnames.c
index f5bf4d8..9ebaba4 100644
--- a/ui/rccnames.c
+++ b/ui/rccnames.c
@@ -1,44 +1,111 @@
#include <stdio.h>
+#include <librcc.h>
+
#include "internal.h"
-const char *rccUiGetLanguageName(rcc_ui_context ctx, const char *lang) {
+rcc_language_name rcc_default_language_names[RCC_MAX_LANGUAGES+1] = {
+{"default", "Autodetect"},
+{"off", "Dissable"},
+{"ru","Russian"},
+{"uk","Ukrainian"},
+{"be","Belarussian"},
+{"bg","Bulgarian"},
+{"cz","Czech"},
+{"es","Estonian"},
+{"hr","Croatian"},
+{"hu","Hungarian"},
+{"lt","Lithuanian"},
+{"lv","Latvian"},
+{"pl","Polish"},
+{"sk","Slovak"},
+{"sl","Slovenian"},
+{"zh","Chinese"},
+{NULL, NULL}
+};
+
+rcc_option_value_name rcc_default_option_boolean_names[] = { "Off", "On", NULL };
+rcc_option_value_name rcc_default_option_learning_names[] = { "Off", "On", "Relearn", "Learn", NULL };
+rcc_option_value_name rcc_default_option_clo_names[] = { "All Languages", "Configured / AutoEngine", "Configured Only", NULL };
+
+rcc_option_name rcc_default_option_names[RCC_MAX_OPTIONS+1] = {
+ { RCC_LEARNING_MODE, "Recodings Cache", rcc_default_option_learning_names },
+ { RCC_AUTODETECT_FS_NAMES, "Autodetect File Names", rcc_default_option_boolean_names },
+ { RCC_AUTODETECT_FS_TITLES, "Autodetect FS Titles", rcc_default_option_boolean_names },
+ { RCC_CONFIGURED_LANGUAGES_ONLY, "Enabled Languages", rcc_default_option_clo_names },
+ { RCC_MAX_OPTIONS }
+};
+
+
+rcc_language_name *rccUiGetLanguageRccName(rcc_ui_context ctx, const char *lang) {
const char *res;
- unsigned int i;
+ unsigned int i,j;
rcc_language_name *names;
- if ((!ctx)||(!lang)) return NULL;
+ if (!lang) return NULL;
- names = ctx->language_names;
+ for (j=0;j<2;j++) {
+ if (j) names = rcc_default_language_names;
+ else names = ctx?ctx->language_names:NULL;
- if (names) {
- for (i=0;names[i].sn;i++)
- if (!strcmp(lang, names[i].sn)) return names[i].name;
+ if (names) {
+ for (i=0;names[i].sn;i++)
+ if (!strcmp(lang, names[i].sn)) return names+i;
+ }
}
+
+ return NULL;
+}
-
- res = rccGetLanguageFullName(lang);
- if (res) return res;
+const char *rccUiGetLanguageName(rcc_ui_context ctx, const char *lang) {
+ const char *res;
+ unsigned int i,j;
+ rcc_language_name *names;
+
+ names = rccUiGetLanguageRccName(ctx, lang);
+ if ((names)&&(names->name)) return names->name;
return lang;
}
+rcc_option_name *rccUiGetOptionRccName(rcc_ui_context ctx, rcc_option option) {
+ unsigned int i,j;
+ rcc_option_name *names;
+
+ if ((option<0)||(option>=RCC_MAX_OPTIONS)) return NULL;
+
+ for (j=0;j<2;j++) {
+ if (j) names = rcc_default_option_names;
+ else names = ctx?ctx->option_names:NULL;
+
+ if (names) {
+ for (i=0;names[i].option!=RCC_MAX_OPTIONS;i++)
+ if (names[i].option == option) return names+i;
+ }
+ }
+
+ return NULL;
+}
+
const char *rccUiGetOptionName(rcc_ui_context ctx, rcc_option option) {
- const char *res;
unsigned int i;
- rcc_option_name *names;
+ rcc_option_name *name;
- if ((!ctx)||(option<0)||(option>RCC_MAX_OPTIONS)) return NULL;
+ name = rccUiGetOptionRccName(ctx, option);
+ if (name) return name->name;
- names = ctx->option_names;
+ return NULL;
+}
- if (names) {
- for (i=0;((i<RCC_MAX_OPTIONS)&&(names[i].option!=RCC_MAX_OPTIONS));i++)
- if (names[i].option == option) return names[i].name;
+const char *rccUiGetOptionValueName(rcc_ui_context ctx, rcc_option option, rcc_option_value value) {
+ unsigned int i;
+ rcc_option_name *name;
+
+ name = rccUiGetOptionRccName(ctx, option);
+ if (name) {
+ for (i=0;name->value_names[i];i++)
+ if (i == value) return name->value_names[i];
}
-
- res = rccGetOptionFullName(option);
- if (res) return res;
return NULL;
}