From 9d4628df369b92016b7fc3bfc7fed6d06ff2ca9a Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 7 Aug 2005 21:41:32 +0000 Subject: - Russian autoengine is renamed to LibRCD - Fix Learning with Language Autodetection switched on - Attempt to perform rccFS with Language Autodetection switched off, if failed with default behaviour. - Systematization of translation engine: + Rearangement of the translation modes: OFF, TO_ENGLISH, SKIP_RELATED, SKIP_PARRENT, FULL. + New class types: TRANSLATE_LOCALE, TRANSLATE_CURRENT, TRANSLATE_FROM. - Detect "Unicode" locales for foreign languages - "out" class is assumed to be TRANSLATE_LOCALE - Respect RCC_CLASS_KNOWN - Check for Latin UTF-8 prior to running any charset detection engine. --- src/lngconfig.c | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'src/lngconfig.c') diff --git a/src/lngconfig.c b/src/lngconfig.c index f9d1d6d..7e5a428 100644 --- a/src/lngconfig.c +++ b/src/lngconfig.c @@ -353,7 +353,7 @@ rcc_speller rccConfigGetSpeller(rcc_language_config config) { if (config->speller) language_id = rccConfigGetLanguage(config); else language_id = (rcc_language_id)-1; - if (language_id != (rcc_language_id)-1) parrents = config->ctx->language_parrents[language_id]; + if (language_id != (rcc_language_id)-1) parrents = ((rcc_language_internal*)config->language)->parrents; else parrents = NULL; if (parrents) { @@ -508,10 +508,12 @@ rcc_charset_id rccConfigGetCurrentCharset(rcc_language_config config, rcc_class_ if (config->default_charset[class_id]) return config->default_charset[class_id]; - charset_id = rccConfigGetLocaleCharset(config, defvalue); - if ((charset_id != 0)&&(charset_id != (rcc_charset_id)-1)) { - config->default_charset[class_id] = charset_id; - return charset_id; + if (cl->defvalue) { + charset_id = rccConfigGetLocaleCharset(config, defvalue); + if ((charset_id != 0)&&(charset_id != (rcc_charset_id)-1)) { + config->default_charset[class_id] = charset_id; + return charset_id; + } } if (cl->defvalue) { @@ -537,7 +539,7 @@ rcc_charset_id rccConfigGetCurrentCharset(rcc_language_config config, rcc_class_ } } - charset_id = rccConfigGetLocaleUnicodeCharset(config, defvalue); + charset_id = rccConfigGetLocaleCharset(config, defvalue); if ((charset_id != 0)&&(charset_id != (rcc_charset_id)-1)) { config->default_charset[class_id] = charset_id; return charset_id; @@ -634,6 +636,7 @@ int rccConfigSetCharsetByName(rcc_language_config config, rcc_class_id class_id, rcc_charset_id rccConfigGetLocaleCharset(rcc_language_config config, const char *locale_variable) { const char *lv; rcc_language_id language_id; + char lang[RCC_MAX_CHARSET_CHARS+1]; char stmp[RCC_MAX_CHARSET_CHARS+1]; if ((!config)||(!config->language)) return (rcc_charset_id)-1; @@ -642,29 +645,17 @@ rcc_charset_id rccConfigGetLocaleCharset(rcc_language_config config, const char language_id = rccGetLanguageByName(config->ctx, config->language->sn); if (language_id != (rcc_language_id)-1) { - if (!rccLocaleGetLanguage(stmp, lv, RCC_MAX_CHARSET_CHARS)) { - if (!strcmp(config->language->sn, stmp)) { - if (!rccLocaleGetCharset(stmp, lv, RCC_MAX_CHARSET_CHARS)) - return rccConfigGetCharsetByName(config, stmp); - } + if (!rccLocaleGetCharset(stmp, lv, RCC_MAX_CHARSET_CHARS)) { + if (rccIsUnicode(stmp)) + return rccConfigGetCharsetByName(config, stmp); + if ((!rccLocaleGetLanguage(lang, lv, RCC_MAX_CHARSET_CHARS))&&(!strcmp(config->language->sn, lang))) + return rccConfigGetCharsetByName(config, stmp); } } return (rcc_charset_id)-1; } -rcc_charset_id rccConfigGetLocaleUnicodeCharset(rcc_language_config config, const char *locale_variable) { - char stmp[RCC_MAX_CHARSET_CHARS+1]; - - if ((!config)||(!config->language)) return (rcc_charset_id)-1; - - if (!rccLocaleGetCharset(stmp, locale_variable?locale_variable:config->ctx->locale_variable, RCC_MAX_CHARSET_CHARS)) { - if (rccIsUTF8(stmp)) return rccConfigGetCharsetByName(config, stmp); - } - - return (rcc_charset_id)-1; -} - int rccConfigConfigure(rcc_language_config config) { int err; rcc_context ctx; -- cgit v1.2.3