summaryrefslogtreecommitdiffstats
path: root/src/rccconfig.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2005-08-05 03:06:50 +0000
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2005-08-05 03:06:50 +0000
commit94ca629ceec7b0dc9f6f724b2e15923d3ec1d5b3 (patch)
tree317019f306f7195c07d3c0d943c829ed11ba8cca /src/rccconfig.c
parent50aa5cd62ef4a66da41d68f4a50ddfca97863c38 (diff)
downloadlibrcc-94ca629ceec7b0dc9f6f724b2e15923d3ec1d5b3.tar.gz
librcc-94ca629ceec7b0dc9f6f724b2e15923d3ec1d5b3.tar.bz2
librcc-94ca629ceec7b0dc9f6f724b2e15923d3ec1d5b3.tar.xz
librcc-94ca629ceec7b0dc9f6f724b2e15923d3ec1d5b3.zip
Language AutoDetection Improvements
- Fix: Loading/Saving range options. - Fix: Language AutoDetection. Using locale language instead of selected one. - Support for range options in GTK UI. - Option to control recoding timeout is provided. - LibRCC.h is updated (Translate, Spell, IConv). - Documentation is updated. - Add 'rcc-config' alias to 'rcc-gtk2-config' in spec. - Implemented concept of parrent languages + The concept is used in language autodetection. The string in considered language is permited to have words from all it's parrent languages. + English is assumed to be parrent for all other languages by default. + Russian is parrent language for Ukrainian and Belorussian. - No translation to english if translation between related (one of the languages is parrent for another one) languages is failed.
Diffstat (limited to 'src/rccconfig.c')
-rw-r--r--src/rccconfig.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/rccconfig.c b/src/rccconfig.c
index f820606..a54b778 100644
--- a/src/rccconfig.c
+++ b/src/rccconfig.c
@@ -6,10 +6,20 @@
#include "engine.h"
#include "opt.h"
-rcc_language_alias rcc_default_aliases[] = {
+#define RCC_DEFAULT_RECODING_TIMEOUT 500000
+
+rcc_language_alias rcc_default_aliases[RCC_MAX_ALIASES + 1];
+rcc_language_alias rcc_default_aliases_embeded[RCC_MAX_ALIASES + 1] = {
{ "cs_SK", "sk" },
{ "ru_UA", "uk" },
- { NULL, NULL}
+ { NULL, NULL }
+};
+
+rcc_language_relation rcc_default_relations[RCC_MAX_RELATIONS + 1];
+rcc_language_relation rcc_default_relations_embeded[RCC_MAX_RELATIONS + 1] = {
+ { "uk", "ru" },
+ { "be", "ru" },
+ { NULL, NULL }
};
const char rcc_default_language_sn[] = "default";
@@ -140,6 +150,11 @@ rcc_option_description rcc_option_descriptions_embeded[RCC_MAX_OPTIONS+1] = {
{RCC_OPTION_TRANSLATE, 0, { RCC_OPTION_RANGE_TYPE_MENU, 0, 3, 1}, RCC_OPTION_TYPE_INVISIBLE, "TRANSLATE", rcc_sn_translate },
#endif /* HAVE_LIBTRANSLATE */
{RCC_OPTION_AUTOENGINE_SET_CURRENT, 0, { RCC_OPTION_RANGE_TYPE_BOOLEAN, 0, 0, 0}, RCC_OPTION_TYPE_STANDARD, "AUTOENGINE_SET_CURRENT", rcc_sn_boolean },
+#ifdef HAVE_LIBTRANSLATE
+ {RCC_OPTION_TIMEOUT, RCC_DEFAULT_RECODING_TIMEOUT, { RCC_OPTION_RANGE_TYPE_RANGE, 0, 5000000, 50000}, RCC_OPTION_TYPE_STANDARD, "TIMEOUT", NULL },
+#else
+ {RCC_OPTION_TIMEOUT, RCC_DEFAULT_RECODING_TIMEOUT, { RCC_OPTION_RANGE_TYPE_RANGE, 0, 5000000, 50000}, RCC_OPTION_TYPE_INVISIBLE, "TIMEOUT", NULL },
+#endif /* HAVE_LIBTRANSLATE */
{RCC_MAX_OPTIONS}
};
@@ -149,7 +164,8 @@ rcc_option_description *rccGetOptionDescription(rcc_option option) {
if ((option<0)||(option>=RCC_MAX_OPTIONS)) return NULL;
for (i=0;rcc_option_descriptions[i].option!=RCC_MAX_OPTIONS;i++)
- if (rcc_option_descriptions[i].option == option) return rcc_option_descriptions+i;
+ if (rcc_option_descriptions[i].option == option)
+ return rcc_option_descriptions+i;
return NULL;
}
@@ -180,3 +196,18 @@ int rccIsUTF8(const char *name) {
if ((!name)||(strcasecmp(name, "UTF-8")&&strcasecmp(name, "UTF8"))) return 0;
return 1;
}
+
+unsigned int rccDefaultDropLanguageRelations(const char *lang) {
+ unsigned long i, j;
+ for (i=0,j=0;rcc_default_relations[i].lang;i++) {
+ if (strcasecmp(lang, rcc_default_relations[i].lang)) {
+ if (j<i) {
+ rcc_default_relations[j].lang = rcc_default_relations[i].lang;
+ rcc_default_relations[j++].parrent = rcc_default_relations[i].parrent;
+ } else j++;
+ }
+ }
+ rcc_default_relations[j].lang = NULL;
+ rcc_default_relations[j].parrent = NULL;
+ return j;
+}