From c95c83950c9de73ca9a01f7b468b72b77c19c051 Mon Sep 17 00:00:00 2001 From: sb Date: Thu, 23 Sep 2010 16:17:38 +0200 Subject: sb132: #i114155# use "en" as additional fallback locale after "en-US" (transplanted from 630d6876c61cd1e0d42b8aa18bfc2ab22079a20f) --- configmgr/source/childaccess.cxx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index ef2b213d4ef1..c20fa49fb18c 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -283,8 +283,9 @@ css::uno::Any ChildAccess::asValue() { // Find best match using an adaption of RFC 4647 lookup matching // rules, removing "-" or "_" delimited segments from the end; // defaults are the empty string locale, the "en-US" locale, the - // first child (if any), or a nil value (even though it may be - // illegal for the given property), in that order: + // "en" locale, the first child (if any), or a nil value (even + // though it may be illegal for the given property), in that + // order: rtl::Reference< ChildAccess > child; for (;;) { child = getChild(locale); @@ -301,10 +302,14 @@ css::uno::Any ChildAccess::asValue() { child = getChild( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US"))); if (!child.is()) { - std::vector< rtl::Reference< ChildAccess > > all( - getAllChildren()); - if (!all.empty()) { - child = all.front(); + child = getChild( + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en"))); + if (!child.is()) { + std::vector< rtl::Reference< ChildAccess > > all( + getAllChildren()); + if (!all.empty()) { + child = all.front(); + } } } } -- cgit v1.2.3 From 731881b92ce7131aff3f78ee8cd9d7c9c524174e Mon Sep 17 00:00:00 2001 From: sb Date: Wed, 17 Nov 2010 15:16:52 +0100 Subject: sb136: #i115386# prefer en[-US] over empty xml:lang value, to accomodate existing extensions with bad .xcu content --- configmgr/source/childaccess.cxx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index c20fa49fb18c..d387f351de30 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -282,8 +282,8 @@ css::uno::Any ChildAccess::asValue() { if (!Components::allLocales(locale)) { // Find best match using an adaption of RFC 4647 lookup matching // rules, removing "-" or "_" delimited segments from the end; - // defaults are the empty string locale, the "en-US" locale, the - // "en" locale, the first child (if any), or a nil value (even + // defaults are the "en-US" locale, the "en" locale, the empty + // string locale, the first child (if any), or a nil value (even // though it may be illegal for the given property), in that // order: rtl::Reference< ChildAccess > child; @@ -296,6 +296,9 @@ css::uno::Any ChildAccess::asValue() { while (i > 0 && locale[i] != '-' && locale[i] != '_') { --i; } + if (i == 0) { + break; + } locale = locale.copy(0, i); } if (!child.is()) { @@ -305,10 +308,13 @@ css::uno::Any ChildAccess::asValue() { child = getChild( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en"))); if (!child.is()) { - std::vector< rtl::Reference< ChildAccess > > all( - getAllChildren()); - if (!all.empty()) { - child = all.front(); + child = getChild(rtl::OUString()); + if (!child.is()) { + std::vector< rtl::Reference< ChildAccess > > + all(getAllChildren()); + if (!all.empty()) { + child = all.front(); + } } } } -- cgit v1.2.3