summaryrefslogtreecommitdiff
path: root/i18npool/source/calendar
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-07-29 20:04:44 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-07-29 22:16:50 +0200
commit155c056b1d4674d5ff73bbb5e1ad1dcd1e6aae36 (patch)
treeab314dc29d575f546fcbd9ea9a03693d7d64343c /i18npool/source/calendar
parent50ceac91a4ac2057847e7d9807f5cb614e6ff755 (diff)
i18npool: create instances with uno constructors
See tdf#74608 for motivation. Change-Id: I814512ccc546bd015558a8122f0d2e3803437e38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99722 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18npool/source/calendar')
-rw-r--r--i18npool/source/calendar/calendar_gregorian.cxx23
1 files changed, 18 insertions, 5 deletions
diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx
index 3aa516814538..69fb08797ab3 100644
--- a/i18npool/source/calendar/calendar_gregorian.cxx
+++ b/i18npool/source/calendar/calendar_gregorian.cxx
@@ -201,14 +201,27 @@ Calendar_hanja::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16
return Calendar_gregorian::getDisplayName( displayIndex, idx, nameType );
}
-void SAL_CALL
-Calendar_hanja::loadCalendar( const OUString& /*uniqueID*/, const css::lang::Locale& rLocale )
+
+Calendar_hanja_yoil::Calendar_hanja_yoil()
+{
+ cCalendar = "com.sun.star.i18n.Calendar_Calendar_hanja_yoil";
+}
+
+OUString SAL_CALL
+Calendar_hanja_yoil::getDisplayName( sal_Int16 displayIndex, sal_Int16 idx, sal_Int16 nameType )
{
- // Since this class could be called by service name 'hanja_yoil', we have to
- // rename uniqueID to get right calendar defined in locale data.
- Calendar_gregorian::loadCalendar("hanja", rLocale);
+ if ( displayIndex == CalendarDisplayIndex::AM_PM ) {
+ // Am/Pm string for Korean Hanja calendar will refer to Japanese locale
+ css::lang::Locale jaLocale("ja", OUString(), OUString());
+ if (idx == 0) return LocaleDataImpl::get()->getLocaleItem(jaLocale).timeAM;
+ else if (idx == 1) return LocaleDataImpl::get()->getLocaleItem(jaLocale).timePM;
+ else throw ERROR;
+ }
+ else
+ return Calendar_gregorian::getDisplayName( displayIndex, idx, nameType );
}
+
const Era gengou_eraArray[] = {
{1868, 1, 1, 0}, // Meiji
{1912, 7, 30, 0}, // Taisho