These are the changes that add ICU4J support to fn:format-integer and date formatting. In particular,
the latest ICU4J 74.1 is added as an optional dependency.
byte[] ordinal in FormatParser is replaced by the numeral type ("ordinal", "cardinal" und "numbering") and byte[] modifier. This was necessary to distinguish the numeral types and at the same time provide a space for extra information, e.g. the ICU rule set name.
all of the ICU support is concentrated in a new subclass of Formatter, named IcuFormatter. It is brought into play by Formatter.get, if available.
instantiation of ICU number format objects is quite expensive, so they are cached per language.
ICU number formats may not be thread safe, so the cache is accessed via a ThreadLocal object.
IcuFormatter tries to do as much as possible at instantiation time, and it also maintains a cache of the rule set names, that it has determined for some given numeral type and format modifier, in order to avoid recalculation.
Note: ICU distinguishes between "ordinal", "cardinal" und "numbering", e.g. in German "erste", "ein", "eins". The definition of fn:format-integer does not do this, rather it declares "cardinal" as the default - but I think it should do. This implementation supports "numbering" as the default. This matches with previous behaviour of BaseX, as is expected in pre-existing BaseX tests. For qt4tests this apparently is not relevant.
These are the changes that add ICU4J support to
fn:format-integer
and date formatting. In particular,byte[] ordinal
inFormatParser
is replaced by the numeral type ("ordinal", "cardinal" und "numbering") andbyte[] modifier
. This was necessary to distinguish the numeral types and at the same time provide a space for extra information, e.g. the ICU rule set name.Formatter
, namedIcuFormatter
. It is brought into play byFormatter.get
, if available.ThreadLocal
object.IcuFormatter
tries to do as much as possible at instantiation time, and it also maintains a cache of the rule set names, that it has determined for some given numeral type and format modifier, in order to avoid recalculation.Note: ICU distinguishes between "ordinal", "cardinal" und "numbering", e.g. in German "erste", "ein", "eins". The definition of
fn:format-integer
does not do this, rather it declares "cardinal" as the default - but I think it should do. This implementation supports "numbering" as the default. This matches with previous behaviour of BaseX, as is expected in pre-existing BaseX tests. For qt4tests this apparently is not relevant.