IntlScriptRecognizer class

Recognize the correct language on intl package when Locale object offered Locale.languageCode and Locale.scriptCode only.

For example, if applying Traditional Chinese (zh_Hant) into intl package (e.g. DateFormat), it takes the fallback result (zh) which is Simplified Chinese. As a result, the formatted String becomes 2023年5月10日 周三 instead of 2023年5月10日 週三 which is simplified character of and both refer to day of week.

By default, it mapped Traditional Chinese (zh_Hant) to intl's recognizable locale String : zh_TW already.

Available extensions

Constructors

IntlScriptRecognizer.new()
Return current instance of IntlScriptRecognizer. For no instance created yet, it will construct a new instance first.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

assign(Map<Locale, String> applyContent, {bool replaceExisted = false}) → void
Assign the Map of applyContent which contains Locale with script code only as a key and a String of country code as value.
constructDateFormat(Locale? locale, [String? newPattern]) → DateFormat

Available on IntlScriptRecognizer, provided by the DateFormatRecognizerExtension extension

Construct a new DateFormat by given locale and newPattern.
constructDateFormatWithPattern(Locale? locale, DateFormat patternFactory(String? formatted)) → DateFormat

Available on IntlScriptRecognizer, provided by the DateFormatRecognizerExtension extension

Construct a new DateFormat with pre-defined format factory Function like below:
isAssigned(Locale locale) bool
Determine the given locale is assign already.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resolve(Locale? locale) String?
Resolving intl recognizable String by the given locale.
toString() String
A string representation of this object.
inherited
unassign(Locale locale) → void
Remove the assign data of locale.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

factoryReset() → void
A last resort Function that construct a new instance and replace the current one which remains default setting only.