[ooo-build-commit] Branch 'ooo/OOO310' - i18npool/source
Jan Holesovsky
kendy at kemper.freedesktop.org
Tue Jul 28 18:22:13 PDT 2009
i18npool/source/calendar/calendar_gregorian.cxx | 34 +++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
New commits:
commit 49d078219a6578f7d686669a0dc1d8c4ca64362c
Author: Kurt Zenker <kz at openoffice.org>
Date: Mon Jul 27 23:30:29 2009 +0000
CWS-TOOLING: integrate CWS thaical311
2009-07-21 12:42:57 +0200 er r274181 : #i102356# init: force Gregorian calendar in spite of what ICU may default to for a locale
diff --git a/i18npool/source/calendar/calendar_gregorian.cxx b/i18npool/source/calendar/calendar_gregorian.cxx
index fd1edc2..7bed274 100644
--- a/i18npool/source/calendar/calendar_gregorian.cxx
+++ b/i18npool/source/calendar/calendar_gregorian.cxx
@@ -148,10 +148,42 @@ void SAL_CALL
Calendar_gregorian::init(Era *_eraArray)
{
cCalendar = "com.sun.star.i18n.Calendar_gregorian";
+
+ // #i102356# With icu::Calendar::createInstance(UErrorCode) in a Thai
+ // th_TH system locale we accidentally used a Buddhist calendar. Though
+ // the ICU documentation says that should be the case only for
+ // th_TH_TRADITIONAL (and ja_JP_TRADITIONAL Gengou), a plain th_TH
+ // already triggers that behavior, ja_JP does not. Strange enough,
+ // passing a th_TH locale to the calendar creation doesn't trigger
+ // this.
+ // See also http://userguide.icu-project.org/datetime/calendar
+
+ // Whatever ICU offers as the default calendar for a locale, ensure we
+ // have a Gregorian calendar as requested.
+
+ /* XXX: with the current implementation the aLocale member variable is
+ * not set prior to loading a calendar from locale data. This
+ * creates an empty (root) locale for ICU, but at least the correct
+ * calendar is used. The language part must not be NULL (respectively
+ * not all, language and country and variant), otherwise the current
+ * default locale would be used again and the calendar keyword ignored.
+ * */
+ icu::Locale aIcuLocale( "", NULL, NULL, "calendar=gregorian");
+
UErrorCode status;
- body = icu::Calendar::createInstance(status = U_ZERO_ERROR);
+ body = icu::Calendar::createInstance( aIcuLocale, status = U_ZERO_ERROR);
if (!body || !U_SUCCESS(status)) throw ERROR;
+#if 0
+ {
+ icu::Locale loc;
+ loc = body->getLocale( ULOC_ACTUAL_LOCALE, status = U_ZERO_ERROR);
+ fprintf( stderr, "\nICU calendar actual locale: %s\n", loc.getName());
+ loc = body->getLocale( ULOC_VALID_LOCALE, status = U_ZERO_ERROR);
+ fprintf( stderr, "ICU calendar valid locale: %s\n", loc.getName());
+ }
+#endif
+
eraArray=_eraArray;
}
More information about the ooo-build-commit
mailing list