Kaydet (Commit) 03e7a16f authored tarafından Eike Rathke's avatar Eike Rathke

use proper LanguageTag fallback instead of dumb startsWith(), fdo#68714

A ca_ES@valencia (=> ca-ES-valencia) locale did not result in
'ca-valencia' UI being selected but 'ca' only instead.

Change-Id: Ifa405add2ff7b45e030b02af4338de195b457cb2
üst f9d868a5
...@@ -58,20 +58,15 @@ OUString getInstalledLocale( ...@@ -58,20 +58,15 @@ OUString getInstalledLocale(
return installed[i]; return installed[i];
} }
} }
// FIXME: It is not very clever to handle the zh-HK -> zh-TW fallback here, ::std::vector<OUString> fallbacks( LanguageTag( locale).getFallbackStrings( false));
// but right now, there is no place that handles those fallbacks globally: for (size_t f=0; f < fallbacks.size(); ++f) {
if (locale == "zh-HK") { const OUString& rf = fallbacks[f];
for (sal_Int32 i = 0; i != installed.getLength(); ++i) { for (sal_Int32 i = 0; i != installed.getLength(); ++i) {
if (installed[i] == "zh-TW") { if (installed[i] == rf) {
return installed[i]; return installed[i];
} }
} }
} }
for (sal_Int32 i = 0; i != installed.getLength(); ++i) {
if (locale.startsWith(installed[i])) {
return installed[i];
}
}
return OUString(); return OUString();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment