From cc476123f53e4e06daa82030eb9200d0eca112de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Timm?= Date: Fri, 13 May 2005 07:09:09 +0000 Subject: [PATCH] INTEGRATION: CWS lo5 (1.14.46); FILE MERGED 2005/04/27 15:16:40 lo 1.14.46.1: #i47440# fallback zh-HK -> zh-TW --- desktop/source/app/langselect.cxx | 43 ++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx index 038edb62e591..4f4d8fe83a88 100644 --- a/desktop/source/app/langselect.cxx +++ b/desktop/source/app/langselect.cxx @@ -2,8 +2,8 @@ * * $RCSfile: langselect.cxx,v $ * - * $Revision: 1.14 $ - * last change: $Author: vg $ $Date: 2005-03-11 10:47:45 $ + * $Revision: 1.15 $ + * last change: $Author: rt $ $Date: 2005-05-13 08:09:09 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -291,6 +291,19 @@ Sequence< OUString > LanguageSelection::getInstalledLanguages() return seqLanguages; } +// FIXME +// it's not very clever to handle language fallbacks here, but +// right now, there is no place that handles those fallbacks globally +static Sequence< OUString > _getFallbackLocales(const OUString& aIsoLang) +{ + Sequence< OUString > seqFallbacks; + if (aIsoLang.equalsAscii("zh-HK")) { + seqFallbacks = Sequence< OUString >(1); + seqFallbacks[0] = OUString::createFromAscii("zh-TW"); + } + return seqFallbacks; +} + sal_Bool LanguageSelection::isInstalledLanguage(OUString& usLocale, sal_Bool bExact) { sal_Bool bInstalled = sal_False; @@ -304,16 +317,34 @@ sal_Bool LanguageSelection::isInstalledLanguage(OUString& usLocale, sal_Bool bEx } } + if (!bInstalled && !bExact) + { + // try fallback locales + Sequence< OUString > seqFallbacks = _getFallbackLocales(usLocale); + for (sal_Int32 j=0; j