summaryrefslogtreecommitdiff
path: root/i18npool/source
diff options
context:
space:
mode:
Diffstat (limited to 'i18npool/source')
-rw-r--r--i18npool/source/characterclassification/characterclassificationImpl.cxx3
-rw-r--r--i18npool/source/collator/collatorImpl.cxx6
-rw-r--r--i18npool/source/isolang/mslangid.cxx59
-rw-r--r--i18npool/source/nativenumber/nativenumbersupplier.cxx4
4 files changed, 63 insertions, 9 deletions
diff --git a/i18npool/source/characterclassification/characterclassificationImpl.cxx b/i18npool/source/characterclassification/characterclassificationImpl.cxx
index 70d1683055fa..df4abe461408 100644
--- a/i18npool/source/characterclassification/characterclassificationImpl.cxx
+++ b/i18npool/source/characterclassification/characterclassificationImpl.cxx
@@ -178,7 +178,6 @@ CharacterClassificationImpl::getLocaleSpecificCharacterClassification(const Loca
}
static sal_Unicode under = (sal_Unicode)'_';
- static OUString tw("TW");
sal_Int32 l = rLocale.Language.getLength();
sal_Int32 c = rLocale.Country.getLength();
sal_Int32 v = rLocale.Variant.getLength();
@@ -197,7 +196,7 @@ CharacterClassificationImpl::getLocaleSpecificCharacterClassification(const Loca
rLocale.Country.compareToAscii("MO") == 0) &&
// if the country code is HK or MO, one more step to try TW.
createLocaleSpecificCharacterClassification(aBuf.append(rLocale.Language).append(under).append(
- tw).makeStringAndClear(), rLocale)) ||
+ "TW").makeStringAndClear(), rLocale)) ||
(l > 0 &&
// load service with name <base>_<lang>
createLocaleSpecificCharacterClassification(rLocale.Language, rLocale))) {
diff --git a/i18npool/source/collator/collatorImpl.cxx b/i18npool/source/collator/collatorImpl.cxx
index 93cc2a6a930d..b76bea6ef853 100644
--- a/i18npool/source/collator/collatorImpl.cxx
+++ b/i18npool/source/collator/collatorImpl.cxx
@@ -195,8 +195,6 @@ CollatorImpl::loadCachedCollator(const lang::Locale& rLocale, const OUString& rS
}
static sal_Unicode under = (sal_Unicode) '_';
- static OUString tw("TW");
- static OUString unicode("Unicode");
sal_Int32 l = rLocale.Language.getLength();
sal_Int32 c = rLocale.Country.getLength();
@@ -215,7 +213,7 @@ CollatorImpl::loadCachedCollator(const lang::Locale& rLocale, const OUString& rS
under).append(rSortAlgorithm).makeStringAndClear(), rSortAlgorithm)) ||
(l > 0 && c > 0 && a > 0 && rLocale.Language == "zh" && (rLocale.Country == "HK" || rLocale.Country == "MO") &&
// if the country code is HK or MO, one more step to try TW.
- createCollator(rLocale, aBuf.append(rLocale.Language).append(under).append(tw).append(under).append(
+ createCollator(rLocale, aBuf.append(rLocale.Language).append(under).append("TW").append(under).append(
rSortAlgorithm).makeStringAndClear(), rSortAlgorithm)) ||
(l > 0 && a > 0 &&
// load service with name <base>_<lang>_<algorithm>
@@ -225,7 +223,7 @@ CollatorImpl::loadCachedCollator(const lang::Locale& rLocale, const OUString& rS
(a > 0 &&
createCollator(rLocale, rSortAlgorithm, rSortAlgorithm)) ||
// load default service with name <base>_Unicode
- createCollator(rLocale, unicode, rSortAlgorithm)) {
+ createCollator(rLocale, "Unicode", rSortAlgorithm)) {
return;
} else {
cachedItem = NULL;
diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx
index 3cd877e4c91b..206a8c71aa41 100644
--- a/i18npool/source/isolang/mslangid.cxx
+++ b/i18npool/source/isolang/mslangid.cxx
@@ -249,9 +249,54 @@ bool MsLangId::isRightToLeft( LanguageType nLang )
return false;
}
+// static
+bool MsLangId::isSimplifiedChinese( LanguageType nLang )
+{
+ return isChinese(nLang) && !isTraditionalChinese(nLang);
+}
// static
-bool MsLangId::hasForbiddenCharacters( LanguageType nLang )
+bool MsLangId::isSimplifiedChinese( const ::com::sun::star::lang::Locale & rLocale )
+{
+ return rLocale.Language == "zh" && !isTraditionalChinese(rLocale);
+}
+
+// static
+bool MsLangId::isTraditionalChinese( LanguageType nLang )
+{
+ bool bRet = false;
+ switch (nLang)
+ {
+ case LANGUAGE_CHINESE_TRADITIONAL:
+ case LANGUAGE_CHINESE_HONGKONG:
+ case LANGUAGE_CHINESE_MACAU:
+ bRet = true;
+ default:
+ break;
+ }
+ return bRet;
+}
+
+// static
+bool MsLangId::isTraditionalChinese( const ::com::sun::star::lang::Locale & rLocale )
+{
+ return rLocale.Language == "zh" && (rLocale.Country == "TW" || rLocale.Country == "HK" || rLocale.Country == "MO");
+}
+
+//static
+bool MsLangId::isChinese( LanguageType nLang )
+{
+ return MsLangId::getPrimaryLanguage(nLang) == LANGUAGE_CHINESE;
+}
+
+//static
+bool MsLangId::isKorean( LanguageType nLang )
+{
+ return MsLangId::getPrimaryLanguage(nLang) == LANGUAGE_KOREAN;
+}
+
+// static
+bool MsLangId::isCJK( LanguageType nLang )
{
switch (nLang & LANGUAGE_MASK_PRIMARY)
{
@@ -265,6 +310,18 @@ bool MsLangId::hasForbiddenCharacters( LanguageType nLang )
return false;
}
+// static
+bool MsLangId::isFamilyNameFirst( LanguageType nLang )
+{
+ return isCJK(nLang) || nLang == LANGUAGE_HUNGARIAN;
+}
+
+// static
+bool MsLangId::hasForbiddenCharacters( LanguageType nLang )
+{
+ return isCJK(nLang);
+}
+
// static
bool MsLangId::needsSequenceChecking( LanguageType nLang )
diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx
index 2d09dabbfa63..cd3d2ca756e3 100644
--- a/i18npool/source/nativenumber/nativenumbersupplier.cxx
+++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx
@@ -26,7 +26,7 @@
*
************************************************************************/
-
+#include <i18npool/mslangid.hxx>
#include <rtl/ustrbuf.hxx>
#include <sal/macros.h>
#include <nativenumbersupplier.hxx>
@@ -526,7 +526,7 @@ static sal_Int16 sizeof_natnum2 = SAL_N_ELEMENTS(natnum2);
static sal_Int16 SAL_CALL getLanguageNumber( const Locale& rLocale)
{
// return zh_TW for TW, HK and MO, return zh_CN for other zh locales.
- if (isLang("zh")) return (isCtry("TW") || isCtry("HK") || isCtry("MO")) ? 1 : 0;
+ if (isLang("zh")) return MsLangId::isTraditionalChinese(rLocale) ? 1 : 0;
for (sal_Int16 i = 2; i < nbOfLocale; i++)
if (isLang(natnum1Locales[i]))