Ticket #6492 (new defect)

SVN Diffs for #6492

 

Opened 1 month ago

Last modified 3 weeks ago

Lack of support for Hebrew numerals in HebrewCalendar

Reported by: tomerm@... Assigned to: emmons
Priority: assess Milestone: UNSCH
Component: unknown Version: Current
Keywords: Hebrew numerals calendar Cc: matial@il.ibm.com
Load: Xref:
Java Version: Operating System: All
Project (C/J): ICU4J Weeks:
Review:

Description

HebrewCalendar does not support Hebrew numerals.

Numbers (digits) are represented in Hebrew calendar with Hebrew numerals (letters). For more information on Hebrew numerals please refer to following article: [en.wikipedia.org/wiki/Hebrew_numerals]

In English locale String representation of date using Hebrew calendar looks like this:

04 tishrei 5768

In Hebrew locale String representation of date using Hebrew calendar should look like this:

H"ASHSAT IERHSIT D

Notice that capital Latin characters stay for Hebrew letters. Instead, ICU4J supports following form:

04 IERHSIT 5768

In other words, only month's name appears in Hebrew while both day and year are represented using Arabic-Western digits instead of Hebrew numerals.

Please notice that in Hebrew language, Hebrew calendar is used exclusively with Hebrew numerals. Here are a couple of real world examples taken from WWW:

  • Israeli newspaper - [www.haaretz.co.il]
  • Israeli news site - [www.inn.co.il]
  • Municipality of Jerusalem - [www.jerusalem.muni.il/jer_main/defaultnew.asp?lng=1]

Please notice that Windows OS also supports Hebrew numerals. When you set default locale to Hebrew and select Hebrew national calendar, days and years in dates are represented with Hebrew numerals instead of Arabic-Western digits.

I realize that support for Hebrew numerals can be considered a localization (or translation) of Hebrew calendar since they are expected to be available only for default Hebrew locale. Currently ICU4J supports localization of Hebrew calendar months only.

I know that ICU uses locale data imported from CLDR[www.unicode.org/cldr/]. However, since it is not possible to translate infinite sequence of integer numbers, I believe that HebrewCalendar should at least provide 2 following functions for conversion between Arabic-Western and Hebrew numerals:

  • String IntegerToHebNumeral(int)
  • int HebNumeralToInteger(String)

This way external applications using ICU4J would be able to properly represent Hebrew date during serialization of Date object into String.

I am not sure if this is a defect or an enhancement. For the time being I defined the issue as defect.

Attachments

HebCalendar_WinOS.JPG (127.4 kB) - added by tomerm@il.ibm.com on 08/17/08 03:07:41.
Selection of Heb. calendar on Win OS and date sample using Heb. calendar

Change History

08/13/08 11:38:39 changed by srl

  • owner changed from somebody to emmons.
  • weeks changed.
  • xref changed.
  • revw changed.

refile in cldr

08/13/08 15:43:20 changed by srl

Data portion of this is refiled as CldrBug:1919 - special API in ICU would not be our first preference.

08/14/08 06:12:01 changed by tomerm@...

I would like to clarify the requirement by giving a very simple code example.

import com.ibm.icu.util.HebrewCalendar import com.ibm.icu.text.SimpleDateFormat import com.ibm.icu.util.ULocale

ULocale hebLocale = new ULocale("he_IL@calendar=hebrew"); HebrewCalendar hebCalendar = new HebrewCalendar(hebLocale); hebCalendar.setTime(new Date());

SimpleDateFormat formatter =

(SimpleDateFormat)hebCalendar.getDateTimeFormat(0,0,hebLocale);

formatter.applyPattern("dd-MMMM-yyyy"); String result = formatter.format(new Date());

This code creates an instance of HebrewCalendar object based on default Hebrew locale. Then using this object the code creates a string representation of current date using following date pattern: dd-MMMM-yyyy

Currently even for Hebrew locale we receive in the result variable the following string:

04-IERHSIT-5768

The expectation is to receive for Hebrew locale the following string:

H"ASHSAT-IERHSIT-D

Please notice that it is also possible to create a Date object based on the String. In this case parsing enhancement should be introduced in order to cope with correct parsing of Hebrew numerals in text form of date representation (i.e. H"ASHSAT-IERHSIT-D).

The first step to achieve this functionality would be to provide following conversion functions:

  • String IntegerToHebNumeral(int)
  • int HebNumeralToInteger(String)

Please notice that it is possible to store translation of days of month using Hebrew numerals since the number of days in a month according to Hebrew calendar does not exceed 40. However, this is not possible for years since number of valid years is not limited (i.e. 1, 2, 3 ... , 5768, 5768, ... 1000 000 ....)

08/17/08 03:04:42 changed by tomerm@...

Here is the example using actual Hebrew characters.

Expected form:

Hebrew calendar in Hebrew locale

ט"ז/אב/תשס"ח

Day of month: ט"ז Month name: אב Year: תשס"ח

Hebrew calendar in English locale

16/Av/5768

Day of month: 16 Month name: Av Year: 5768

Currently ICU4J supports the following form:

Hebrew calendar in Hebrew locale

16/אב‎/5768

Day of month: 16 Month name: אב Year: 5768

Hebrew calendar in English locale

16/Av/5768

Day of month: 16 Month name: Av Year: 5768

In other words, from the support for Hebrew national calendar ICU4J works fine for English locale but has only partial support (for Hebrew months names)in Hebrew locale.

I also don't think that the current support should be removed until support for Hebrew numerals is introduced.

I would emphasis once again, that it seems that at least for years (which come from the infinite sequence of integer numbers) supporting Hebrew numerals in CLDR might be problematic since CLDR has no provision for algorithmic "translations".

08/17/08 03:07:41 changed by tomerm@...

  • attachment HebCalendar_WinOS.JPG added.

Selection of Heb. calendar on Win OS and date sample using Heb. calendar


Add/Change #6492 (Lack of support for Hebrew numerals in HebrewCalendar)




Anti spam check: