summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--i18npool/source/collator/collator_unicode.cxx9
1 files changed, 4 insertions, 5 deletions
diff --git a/i18npool/source/collator/collator_unicode.cxx b/i18npool/source/collator/collator_unicode.cxx
index 40b5c47ab798..a7cf05ba389a 100644
--- a/i18npool/source/collator/collator_unicode.cxx
+++ b/i18npool/source/collator/collator_unicode.cxx
@@ -22,6 +22,8 @@
#include "lrl_include.hxx"
#include <rtl/ustrbuf.hxx>
+#include <i18nlangtag/languagetag.hxx>
+#include <i18nlangtag/languagetagicu.hxx>
#include <collator_unicode.hxx>
#include <localedata.hxx>
#include <com/sun/star/i18n/CollatorOptions.hpp>
@@ -213,13 +215,10 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
/** ICU collators are loaded using a locale only.
ICU uses Variant as collation algorithm name (like de__PHONEBOOK
locale), note the empty territory (Country) designator in this special
- case here. The icu::Locale contructor changes the algorithm name to
+ case here. The icu::Locale constructor changes the algorithm name to
uppercase itself, so we don't have to bother with that.
*/
- icu::Locale icuLocale(
- OUStringToOString(rLocale.Language, RTL_TEXTENCODING_ASCII_US).getStr(),
- OUStringToOString(rLocale.Country, RTL_TEXTENCODING_ASCII_US).getStr(),
- OUStringToOString(rAlgorithm, RTL_TEXTENCODING_ASCII_US).getStr());
+ icu::Locale icuLocale( LanguageTagIcu::getIcuLocale( LanguageTag( rLocale), rAlgorithm));
// load ICU collator
collator = (RuleBasedCollator*) icu::Collator::createInstance(icuLocale, status);
if (! U_SUCCESS(status)) throw RuntimeException();