Expose Transliterator API
- Hide registry methods
- Disallow subclassing since it's mostly useful for registry
- Hide constructor and protected methods
- Remove some java doc about subclassing
- Hide Transform / StringTransform related methods
- The interfaces are not useful, since there are no other consumers
of the interfaces. The functionality has been provided by transliterate(String)
API Usage:
Key APIs:
Transliterator getInstance(String)
String transliterate(String, ...)
String transliterate(Replaceable,...)
Enumeration getAvailableIDs()
Transliterator createFromRules(String, String, int)
- Use application-supplied transliteration rules. Some Android
IMEs (Input Method Editors) have been requesting this API.
static field Forward
static field Reverse
Incremental processing (Keyboard transliteration):
void transliterate(Replacable, Position, ...)
void finishTransliteration(Replaceable, ...)
class Transliterator.Position
Unicode filtering:
void setFilter(UnicodeFilter)
UnicodeFilter getFilter()
void filteredTransliterate(android.icu.text.Replaceable, Position, boolean)
Information / meta-data of the Transliterator:
String getID()
int getMaximumContextLength()
String getDisplayName(String, ...)
UnicodeSet getSourceSet()
UnicodeSet getTargetSet()
String toRules(boolean)
Transliterator[] getElements()
Helper methods:
Enumeration getAvailableSources()
Enumeration getAvailableTargets(String)
Enumeration getAvailableVariants(String, String)
Transliterator getInverse()
CTS coverage:
All the public APIs have been covered by CtsIcuTestCases.
Rule syntax is tested in TransliteratorTest
Add a new test AndroidTransliteratorTest:
Ensure that Android devices provides a consistent set of translieration ids.
If a transliteration id should be optional, please add to
Icu4jTestsTransform.EXCLUDED_TRANSLITERATION_IDS.
The caller should still check the existence of id
from the API Translierator.getAvailableIDs().
The list of Ids is generated,
and should be reviewed during ICU upgrade.
Test: CtsIcuTestCases android.icu.dev.test.translit.TransliteratorTest
Test: AndroidTransliteratorAvailableIdsTest
Test: AndroidTransliteratorParameterizedTest
Bug: 109663008
Change-Id: Iad6c510c73590d0afc92891b2e95fc487e4bb183
9 files changed