diff options
author | abdulmajeed ahmed <aalabdulrazzaq@kacst.edu.sa> | 2013-06-21 11:07:34 +0200 |
---|---|---|
committer | abdulmajeed ahmed <aalabdulrazzaq@kacst.edu.sa> | 2013-06-21 11:14:17 +0200 |
commit | 448fa131b2dafac305d88480e469cc4bc0515d68 (patch) | |
tree | 4f8f94215ce38a9c7ccb0d3edb4af3bb62aa5b38 /i18npool | |
parent | 832612bb6bd013cf68a64e33827158f96e6d03d3 (diff) |
Fix fdo#52204 add new feature ignore diacritics in search for CTL
Change-Id: Ie9044a35003217545bacea214ef59047bff3b8b1
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/Library_i18npool.mk | 1 | ||||
-rw-r--r-- | i18npool/inc/transliteration_Ignore.hxx | 5 | ||||
-rw-r--r-- | i18npool/source/localedata/data/ar_DZ.xml | 2 | ||||
-rw-r--r-- | i18npool/source/localedata/data/ar_EG.xml | 10 | ||||
-rw-r--r-- | i18npool/source/localedata/data/ar_LB.xml | 2 | ||||
-rw-r--r-- | i18npool/source/localedata/data/ar_OM.xml | 6 | ||||
-rw-r--r-- | i18npool/source/localedata/data/ar_SA.xml | 2 | ||||
-rw-r--r-- | i18npool/source/localedata/data/ar_TN.xml | 2 | ||||
-rw-r--r-- | i18npool/source/registerservices/registerservices.cxx | 2 | ||||
-rw-r--r-- | i18npool/source/transliteration/ignoreDiacritics_CTL.cxx | 45 | ||||
-rw-r--r-- | i18npool/source/transliteration/transliterationImpl.cxx | 7 | ||||
-rw-r--r-- | i18npool/util/i18npool.component | 3 |
12 files changed, 77 insertions, 10 deletions
diff --git a/i18npool/Library_i18npool.mk b/i18npool/Library_i18npool.mk index b5786646152b..158f93f45168 100644 --- a/i18npool/Library_i18npool.mk +++ b/i18npool/Library_i18npool.mk @@ -93,6 +93,7 @@ $(eval $(call gb_Library_add_exception_objects,i18npool,\ i18npool/source/transliteration/ignoreTraditionalKanji_ja_JP \ i18npool/source/transliteration/ignoreWidth \ i18npool/source/transliteration/ignoreZiZu_ja_JP \ + i18npool/source/transliteration/ignoreDiacritics_CTL \ i18npool/source/transliteration/katakanaToHiragana \ i18npool/source/transliteration/largeToSmall_ja_JP \ i18npool/source/transliteration/numtochar \ diff --git a/i18npool/inc/transliteration_Ignore.hxx b/i18npool/inc/transliteration_Ignore.hxx index 26f92523c8d5..e66e16aff2f0 100644 --- a/i18npool/inc/transliteration_Ignore.hxx +++ b/i18npool/inc/transliteration_Ignore.hxx @@ -113,6 +113,11 @@ TRANSLITERATION_IGNORE(TraditionalKanji_ja_JP) #if defined( TRANSLITERATION_ZiZu_ja_JP ) || defined( TRANSLITERATION_ALL ) TRANSLITERATION_IGNORE(ZiZu_ja_JP) #endif + +#if defined( TRANSLITERATION_Diacritics_CTL ) || defined( TRANSLITERATION_ALL ) +TRANSLITERATION_IGNORE(Diacritics_CTL) +#endif + #undef TRANSLITERATION_IGNORE #define TRANSLITERATION_IGNORE( name ) \ diff --git a/i18npool/source/localedata/data/ar_DZ.xml b/i18npool/source/localedata/data/ar_DZ.xml index c3c3be7a678e..bb63392202d3 100644 --- a/i18npool/source/localedata/data/ar_DZ.xml +++ b/i18npool/source/localedata/data/ar_DZ.xml @@ -453,7 +453,7 @@ <DecimalPlaces>2</DecimalPlaces> </Currency> </LC_CURRENCY> - <LC_TRANSLITERATION ref="en_US"/> + <LC_TRANSLITERATION ref="ar_EG"/> <LC_MISC ref="ar_EG"/> <LC_NumberingLevel ref="ar_EG"/> <LC_OutLineNumberingLevel ref="ar_EG"/> diff --git a/i18npool/source/localedata/data/ar_EG.xml b/i18npool/source/localedata/data/ar_EG.xml index defa49ec9ac4..662a913d8a55 100644 --- a/i18npool/source/localedata/data/ar_EG.xml +++ b/i18npool/source/localedata/data/ar_EG.xml @@ -458,7 +458,15 @@ <DecimalPlaces>2</DecimalPlaces> </Currency> </LC_CURRENCY> - <LC_TRANSLITERATION ref="en_US"/> + <LC_TRANSLITERATION> + <Transliteration unoid="SENTENCE_CASE"/> + <Transliteration unoid="LOWERCASE_UPPERCASE"/> + <Transliteration unoid="UPPERCASE_LOWERCASE"/> + <Transliteration unoid="TITLE_CASE"/> + <Transliteration unoid="TOGGLE_CASE"/> + <Transliteration unoid="IGNORE_CASE"/> + <Transliteration unoid="ignoreDiacritics_CTL"/> + </LC_TRANSLITERATION> <LC_MISC> <ReservedWords> <trueWord>صح</trueWord> diff --git a/i18npool/source/localedata/data/ar_LB.xml b/i18npool/source/localedata/data/ar_LB.xml index 86aba6114901..9499dfb8ba48 100644 --- a/i18npool/source/localedata/data/ar_LB.xml +++ b/i18npool/source/localedata/data/ar_LB.xml @@ -300,7 +300,7 @@ <DecimalPlaces>2</DecimalPlaces> </Currency> </LC_CURRENCY> - <LC_TRANSLITERATION ref="en_US"/> + <LC_TRANSLITERATION ref="ar_EG"/> <LC_MISC ref="ar_EG"/> <LC_NumberingLevel ref="ar_EG"/> <LC_OutLineNumberingLevel ref="ar_EG"/> diff --git a/i18npool/source/localedata/data/ar_OM.xml b/i18npool/source/localedata/data/ar_OM.xml index d29304696ff7..5c4bfd73ff55 100644 --- a/i18npool/source/localedata/data/ar_OM.xml +++ b/i18npool/source/localedata/data/ar_OM.xml @@ -341,11 +341,7 @@ <DecimalPlaces>2</DecimalPlaces> </Currency> </LC_CURRENCY> - <LC_TRANSLITERATION> - <Transliteration unoid="LOWERCASE_UPPERCASE"/> - <Transliteration unoid="UPPERCASE_LOWERCASE"/> - <Transliteration unoid="IGNORE_CASE"/> - </LC_TRANSLITERATION> + <LC_TRANSLITERATION ref="ar_EG"/> <LC_MISC> <ReservedWords> <trueWord>صحيح</trueWord> diff --git a/i18npool/source/localedata/data/ar_SA.xml b/i18npool/source/localedata/data/ar_SA.xml index 01b596c63658..05f0fb81edb3 100644 --- a/i18npool/source/localedata/data/ar_SA.xml +++ b/i18npool/source/localedata/data/ar_SA.xml @@ -300,7 +300,7 @@ <DecimalPlaces>2</DecimalPlaces> </Currency> </LC_CURRENCY> - <LC_TRANSLITERATION ref="en_US"/> + <LC_TRANSLITERATION ref="ar_EG"/> <LC_MISC ref="ar_EG"/> <LC_NumberingLevel ref="ar_EG"/> <LC_OutLineNumberingLevel ref="ar_EG"/> diff --git a/i18npool/source/localedata/data/ar_TN.xml b/i18npool/source/localedata/data/ar_TN.xml index b69ad31a3ad2..014f77524603 100644 --- a/i18npool/source/localedata/data/ar_TN.xml +++ b/i18npool/source/localedata/data/ar_TN.xml @@ -300,7 +300,7 @@ <DecimalPlaces>3</DecimalPlaces> </Currency> </LC_CURRENCY> - <LC_TRANSLITERATION ref="en_US"/> + <LC_TRANSLITERATION ref="ar_EG"/> <LC_MISC ref="ar_EG"/> <LC_NumberingLevel ref="ar_EG"/> <LC_OutLineNumberingLevel ref="ar_EG"/> diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index b9c19b082bc5..ca87c024ef6f 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -190,6 +190,7 @@ IMPL_CREATEINSTANCE( ignoreSize_ja_JP) IMPL_CREATEINSTANCE( ignoreProlongedSoundMark_ja_JP) IMPL_CREATEINSTANCE( ignoreMiddleDot_ja_JP) IMPL_CREATEINSTANCE( ignoreSpace_ja_JP) +IMPL_CREATEINSTANCE( ignoreDiacritics_CTL) IMPL_CREATEINSTANCE( TextToChuyin_zh_TW ) IMPL_CREATEINSTANCE( TextToPinyin_zh_CN ) @@ -465,6 +466,7 @@ static const struct InstancesArray { IMPL_TRANSLITERATION_ITEM (ignoreSpace_ja_JP), IMPL_TRANSLITERATION_ITEM (TextToPinyin_zh_CN), IMPL_TRANSLITERATION_ITEM (TextToChuyin_zh_TW), + IMPL_TRANSLITERATION_ITEM( ignoreDiacritics_CTL), IMPL_TRANSLITERATION_ITEM (NumToCharUpper_zh_CN), IMPL_TRANSLITERATION_ITEM (NumToCharLower_zh_CN), diff --git a/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx b/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx new file mode 100644 index 000000000000..f4de2c5b2bc1 --- /dev/null +++ b/i18npool/source/transliteration/ignoreDiacritics_CTL.cxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#define TRANSLITERATION_Diacritics_CTL +#include <transliteration_Ignore.hxx> + +namespace com { namespace sun { namespace star { namespace i18n { + +sal_Unicode +ignoreDiacritics_CTL_translator (const sal_Unicode c) +{ + switch (c) { + //Arabic Diacritics + case 0x064B: + case 0x064C: + case 0x064D: + case 0x064E: + case 0x064F: + case 0x0650: + case 0x0651: + case 0x0652: + // no break; + return 0xffff; // Skip this character + } + return c; +} + +ignoreDiacritics_CTL::ignoreDiacritics_CTL() +{ + func = ignoreDiacritics_CTL_translator; + table = 0; + map = 0; + transliterationName = "ignoreDiacritics_CTL"; + implementationName = "com.sun.star.i18n.Transliteration.ignoreDiacritics_CTL"; +} + +} } } } + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/transliteration/transliterationImpl.cxx b/i18npool/source/transliteration/transliterationImpl.cxx index e8f3f2c168be..fddb41c7b905 100644 --- a/i18npool/source/transliteration/transliterationImpl.cxx +++ b/i18npool/source/transliteration/transliterationImpl.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/i18n/LocaleData.hpp> #include <com/sun/star/i18n/TransliterationType.hpp> +#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <com/sun/star/lang/XComponent.hpp> #include <comphelper/processfactory.hxx> @@ -191,6 +192,12 @@ TransliterationImpl::loadModule( TransliterationModules modType, const Locale& r bodyCascade[numCascade], rLocale)) numCascade++; } + // additional transliterations from TranslationModuleExtra (we cannot extend TransliterationModule) + if (modType & TransliterationModulesExtra::ignoreDiacritics_CTL) + { + if (loadModuleByName(OUString("ignoreDiacritics_CTL"), bodyCascade[numCascade], rLocale)) + numCascade++; + } } else if (modType&TransliterationModules_NON_IGNORE_MASK) { for (sal_Int16 i = 0; TMlist[i].tm; i++) { if (TMlist[i].tm == modType) { diff --git a/i18npool/util/i18npool.component b/i18npool/util/i18npool.component index 7f96470b54f3..559d0bf834b7 100644 --- a/i18npool/util/i18npool.component +++ b/i18npool/util/i18npool.component @@ -472,4 +472,7 @@ <implementation name="com.sun.star.text.DefaultNumberingProvider"> <service name="com.sun.star.text.DefaultNumberingProvider"/> </implementation> + <implementation name="com.sun.star.i18n.Transliteration.ignoreDiacritics_CTL"> + <service name="com.sun.star.i18n.Transliteration.l10n"/> + </implementation> </component> |