IntlScriptRecognizer class final
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. If no
instance created yet, it will construct a new instance first.
factory
-
IntlScriptRecognizer.delicated({Set<
String> customRegion}) -
Construct a delicated IntlScriptRecognizer that it no longer memorize
instance and return current instance by calling IntlScriptRecognizer.new.
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
-
applyCustomRegion(
Set< String> ? customRegion) → void - Define custom country code which may not recognized as country code yet or using as testing purpose.
-
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
ConstructDateFormat.new
by givenlocale
andnewPattern
. -
constructDateFormatWithPattern(
Locale? locale, DateFormatPatternFactory patternFactory) → DateFormat -
Available on IntlScriptRecognizer, provided by the DateFormatRecognizerExtension extension
Construct a newDateFormat
with pre-defined format factory Function like below: -
dateFormatFromContext(
BuildContext context, [String? newPattern]) → DateFormat -
Available on IntlScriptRecognizer, provided by the DateFormatRecognizerExtension extension
ConstructDateFormat.new
with resolveFromContext. -
dateFormatWithPatternFromContext(
BuildContext context, DateFormatPatternFactory patternFactory) → DateFormat -
Available on IntlScriptRecognizer, provided by the DateFormatRecognizerExtension extension
ConstructDateFormat
with pre-defined pattern. -
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 givenlocale
. -
resolveFromContext(
BuildContext context) → String? - Perform resolve from Localizations.maybeLocaleOf.
-
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.