diff options
author | Eike Rathke <erack@redhat.com> | 2013-09-05 12:45:00 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-09-05 14:57:27 +0200 |
commit | 2ba7a3d0156973f6be1efbedb30c3109cba8bc5f (patch) | |
tree | e0bb61b7a757f22b7bb9e1c924cf925d5a40df6d /i18npool | |
parent | 37126d76ed236be09368f98016a7a89e0bd5ea6e (diff) |
handle language tags
Change-Id: I7367fd5f48f4b2733f515ff63238072f21579d35
Diffstat (limited to 'i18npool')
-rw-r--r-- | i18npool/source/localedata/localedata.cxx | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index d394a2887d7f..8b708abc13ca 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -577,17 +577,24 @@ Sequence< CalendarItem2 > &LocaleData::getCalendarItemByName(const OUString& nam throw(RuntimeException) { if (!ref_name.equals(name)) { - sal_Int32 index = 0; - OUString language = name.getToken(0, cUnder, index); - OUString country = name.getToken(0, cUnder, index); - Locale loc(language, country, OUString()); + OUString aLocStr, id; + sal_Int32 nLastUnder = name.lastIndexOf( cUnder); + SAL_WARN_IF( nLastUnder < 1, "i18npool", + "LocaleData::getCalendarItemByName - no '_' or first in name can't be right: " << name); + if (nLastUnder >= 0) + { + aLocStr = name.copy( 0, nLastUnder); + if (nLastUnder + 1 < name.getLength()) + id = name.copy( nLastUnder + 1); + } + Locale loc( LanguageTag::convertToLocale( aLocStr.replace( cUnder, cHyphen))); Sequence < Calendar2 > cals; if (loc == rLocale) { cals = calendarsSeq; } else { cals = getAllCalendars2(loc); } - const OUString& id = name.getToken(0, cUnder, index); + sal_Int32 index; for (index = 0; index < cals.getLength(); index++) { if (id.equals(cals[index].Name)) { ref_cal = cals[index]; |