Kaydet (Commit) 0cb65cee authored tarafından Eike Rathke's avatar Eike Rathke

use LanguageTagIcu

Change-Id: I7b052a3f73740ff3a35f38dc2d96bc621b8d8deb
üst 4806df61
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "lrl_include.hxx" #include "lrl_include.hxx"
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <i18nlangtag/languagetagicu.hxx>
#include <collator_unicode.hxx> #include <collator_unicode.hxx>
#include <localedata.hxx> #include <localedata.hxx>
#include <com/sun/star/i18n/CollatorOptions.hpp> #include <com/sun/star/i18n/CollatorOptions.hpp>
...@@ -213,13 +215,10 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang:: ...@@ -213,13 +215,10 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
/** ICU collators are loaded using a locale only. /** ICU collators are loaded using a locale only.
ICU uses Variant as collation algorithm name (like de__PHONEBOOK ICU uses Variant as collation algorithm name (like de__PHONEBOOK
locale), note the empty territory (Country) designator in this special 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. uppercase itself, so we don't have to bother with that.
*/ */
icu::Locale icuLocale( icu::Locale icuLocale( LanguageTagIcu::getIcuLocale( LanguageTag( rLocale), rAlgorithm));
OUStringToOString(rLocale.Language, RTL_TEXTENCODING_ASCII_US).getStr(),
OUStringToOString(rLocale.Country, RTL_TEXTENCODING_ASCII_US).getStr(),
OUStringToOString(rAlgorithm, RTL_TEXTENCODING_ASCII_US).getStr());
// load ICU collator // load ICU collator
collator = (RuleBasedCollator*) icu::Collator::createInstance(icuLocale, status); collator = (RuleBasedCollator*) icu::Collator::createInstance(icuLocale, status);
if (! U_SUCCESS(status)) throw RuntimeException(); if (! U_SUCCESS(status)) throw RuntimeException();
......
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