classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

locale compiler


From: Tom Tromey
Subject: locale compiler
Date: 02 Jan 2002 19:03:21 -0700

Over the holidays I hacked localedef a bit so that it can generate
Java output.  My goal was to let us automatically generate the
gnu.java.locale.* classes from the existing locale files, so that we
don't have to find a way to duplicate all this information.

My hack doesn't yet handle collation (which is one of the important
things I hoped to get from this), but it looks like I won't have time
to work on it again in the near future.

The code is finished enough that I can see that the POSIX locale files
don't have enough information :-(

In particular these things at least are missing:

* Time zone names
* Several date formats (Java supports more pre-canned date and time
  formats than POSIX)
* era (BC/AD) information (at least in the simple way we approach it)
* Localized pattern characters for DateFormatSymbols
* Various number-formatting things (percent, exponential, per-mill,
  infinity, zero digit, maybe more)

I haven't looked at calendrical localizations yet.

(On the other hand POSIX includes a bunch of stuff that Java doesn't
seem to address.)

I'm not sure what to do about the missing bits.  I'd prefer not to
edit the output of `localedef --java', since presumably we'll want to
re-run it from time to time.

One idea I had was to generate code like this:

    { "localPatternChars", LocaleInformation_en.localPatternChars },

The idea here is that we only generate language_COUNTRY files, so we
could put missing data in the hand-maintained language-only files.
The problem with doing this is that we then need to add such
definitions for every language.  Currently there are 131 locales for
67 languages, so this is a lot (not to mention that the results might
not always be correct anyway).

Any other ideas?

If anyone is interested in hacking ld-collate.c or in looking at the
calendar code, I'd be happy to send my localedef patch.  I haven't yet
showed it to the glibc maintainers; my guess is that they won't want
it and we'll have to maintain our own hacked version separately.  This
shouldn't be a big deal.

I'm interested in checking in the output even though it isn't
complete.  It's certainly better than what we have right now (next to
nothing).  I thought I'd ask to see if anybody had an objection before
checking in 131 new files though.

Tom



reply via email to

[Prev in Thread] Current Thread [Next in Thread]