[Libreoffice-commits] .: tools/source
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Jun 7 03:34:30 PDT 2011
tools/source/rc/resmgr.cxx | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
New commits:
commit 52c9f63bf73882d4aa4734ce546df338b6deddb4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jun 7 11:27:42 2011 +0100
fallback through en-US from unlocalized en-XX locales
diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx
index 9c12821..f397532 100644
--- a/tools/source/rc/resmgr.cxx
+++ b/tools/source/rc/resmgr.cxx
@@ -281,6 +281,18 @@ void ResMgrContainer::init()
MsLangId::convertLanguageToLocale(nLang, m_aDefLocale);
}
+namespace
+{
+ bool isAlreadyPureenUS(const com::sun::star::lang::Locale &rLocale)
+ {
+ return (
+ rLocale.Language.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("en")) &&
+ rLocale.Country.equalsAsciiL(RTL_CONSTASCII_STRINGPARAM("US")) &&
+ rLocale.Variant.getLength() == 0
+ );
+ }
+}
+
InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix,
com::sun::star::lang::Locale& rLocale,
bool bForceNewInstance
@@ -331,7 +343,7 @@ InternalResMgr* ResMgrContainer::getResMgr( const OUString& rPrefix,
}
break;
}
- if( nTries == 0 && !aLocale.Language.equalsIgnoreAsciiCaseAscii( "en" ) )
+ if( nTries == 0 && !isAlreadyPureenUS(aLocale) )
{
// locale fallback failed
// fallback to en-US locale
@@ -448,7 +460,7 @@ InternalResMgr* ResMgrContainer::getNextFallback( InternalResMgr* pMgr )
aLocale.Variant = OUString();
else if( aLocale.Country.getLength() )
aLocale.Country = OUString();
- else if( ! aLocale.Language.equalsIgnoreAsciiCaseAscii( "en" ) )
+ else if( !isAlreadyPureenUS(aLocale) )
{
aLocale.Language = OUString( RTL_CONSTASCII_USTRINGPARAM( "en" ) );
aLocale.Country = OUString( RTL_CONSTASCII_USTRINGPARAM( "US" ) );
More information about the Libreoffice-commits
mailing list