introduce MessageFormat base class: only string substitution

Description

We should introduce a new base class underneath MessageFormat with just string substitution functionality and without direct support for number/date/plural/... formatting. ChoiceFormat might be ok unless it requires NumberFormat.

The base class should be in the ICU "core" and not drag in any significant code or data. It would need to provide a registry that associates placeholder type strings ("number", "date", "plural", ...) with classes that handle those types. The full MessageFormat would register its known sub-formats at first use.

This would allow simple formatting, for example for locale and time zone display names, without dragging in the number/date/time/etc. formatting code and data. It would also allow the use of a small ICU subset for simple message catalog work.

Activity

Show:
TracBot
June 30, 2018, 11:35 PM
Trac Comment 10 by —2016-01-27T00:35:10.693Z

ICU 57 adds public SimpleFormatter which is even more basic than a MessageFormat base class. It seems to do most of what we need. In some places, MessageFormat is used for parsing, but I don't think a base class would be a good replacement.

TracBot
June 30, 2018, 11:35 PM
Trac Comment 8 by —2015-04-01T22:54:07.170Z

Travis has created an internal, simple class for formatting trivial patterns. See where we can use that, or whether we would want to modify that first.

TracBot
June 30, 2018, 11:35 PM
Trac Comment 3 by —2011-04-22T22:16:20.022Z

We need to talk about what we need and want.

ICU 4.8 has MessagePattern which we can use. We definitely want to format trivial CLDR patterns like "{1} ({0})" with a small implementation that does not depend on every other *Format class.

We could write a base class, or a separate class just for simple formatting; the latter could be public or internal.

Won't Fix [deprecated]

Assignee

Yoshito Umaoka

Reporter

Markus Scherer

Components

Labels

None

Reviewer

None

Priority

medium

Time Needed

Weeks

Fix versions

None