https://bugs.documentfoundation.org/show_bug.cgi?id=169369
Bug ID: 169369
Summary: Use ICU library instead of implementing different
calendar types
Product: LibreOffice
Version: Inherited From OOo
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: LibreOffice
Assignee: [email protected]
Reporter: [email protected]
Description:
LibreOffice provides 9 different calendar types as listed here: (some are only
different display names)
$ grep i18npool_Calendar_ i18npool/util/i18npool.component
constructor="i18npool_Calendar_ROC_get_implementation">
constructor="i18npool_Calendar_dangi_get_implementation">
constructor="i18npool_Calendar_buddhist_get_implementation">
constructor="i18npool_Calendar_gengou_get_implementation">
constructor="i18npool_Calendar_gregorian_get_implementation">
constructor="i18npool_Calendar_hanja_get_implementation">
constructor="i18npool_Calendar_hanja_yoil_get_implementation">
constructor="i18npool_Calendar_hijri_get_implementation">
constructor="i18npool_Calendar_jewish_get_implementation">
They are:
1. ROC
2. Dangi
3. Buddhist
4. Gengou
5. Gregorian
6. Hanja
7. Hanja Yoil
8. Hijri
9. Jewish
These are implemented in LibreOffice in i18npool/source/calendar in 1.5 LOC in
C++.
On the other hand, some widely used calendar systems exist that are not
supported in LibreOffice. For example, request for implementing Jalali
(Persian) calendar system is filed as tdf#147660.
The good news is that ICU provides cross platform implementation for 18
calendar types, either calendar systems or alternative display names:
https://github.com/unicode-org/icu/blob/main/docs/userguide/datetime/calendar/index.md
https://deepwiki.com/unicode-org/icu/5.1-calendar-systems
List of 18 supported calendar types can be seen in:
icu4c/source/i18n/calendar.cpp:
static const char * const gCalTypes[] = {
"gregorian",
"japanese",
"buddhist",
"roc",
"persian",
"islamic-civil",
"islamic",
"hebrew",
"chinese",
"indian",
"coptic",
"ethiopic",
"ethiopic-amete-alem",
"iso8601",
"dangi",
"islamic-umalqura",
"islamic-tbla",
"islamic-rgsa",
nullptr
};
The ICU library is already part of the external libraries that are linked to
LibreOffice.
The task here is to replace the internal implementation with the one provided
by ICU. The above file is actually available as below, and can be simply used
in i18npool module of LibreOffice:
workdir/UnpackedTarball/icu/source/i18n/calendar.cpp (~3K LOC C++)
Some code refactoring and restructuring will be needed to provide support for
additional calendar systems provided by ICU. Then, locales should be also
modified to use appropriate calendars, which were not available before.
Please note that macOS and Windows provide their own implementation of calendar
systems, which can be set in their locale settings and is available in their
native API. But, those native APIs are not relevant here.
--
You are receiving this mail because:
You are the assignee for the bug.