diff options
author | sb <sb@openoffice.org> | 2010-11-17 15:16:52 +0100 |
---|---|---|
committer | Rene Engelhard <rene@debian.org> | 2010-11-21 14:48:52 +0100 |
commit | 56efc141e784a0c1ab7de9a91cc83ab688df381e (patch) | |
tree | 94ced9d3cce10a981d4a25bc68ad2a1bdb54342d /configmgr | |
parent | 830738b795cbb5c7998d13b665dd905efb0205e0 (diff) |
sb136: #i115386# prefer en[-US] over empty xml:lang value, to accomodate existing extensions with bad .xcu content
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/childaccess.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/configmgr/source/childaccess.cxx b/configmgr/source/childaccess.cxx index d3b54800e41a..3ec23b73f12f 100644 --- a/configmgr/source/childaccess.cxx +++ b/configmgr/source/childaccess.cxx @@ -283,8 +283,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; @@ -297,6 +297,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()) { @@ -306,10 +309,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(); + } } } } |