I18nManager class
Manager for internationalization support according to MCP UI DSL v1.0
- Inheritance
-
- Object
- ChangeNotifier
- I18nManager
Properties
- currentLocale → String
-
no setter
- fallbackLocale → String
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
translationKeys
→ Set<
String> -
Return all top-level keys for the current locale
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clear(
) → void - Clear all translations
-
dispose(
) → void -
Discards any resources used by the object.
inherited
-
formatCurrency(
num value, {String? currency, String? locale}) → String - Format a number as currency using basic Dart formatting
-
formatDate(
DateTime date, {String? pattern, String? locale}) → String - Format a date using basic Dart formatting
-
formatNumber(
num value, {String? locale}) → String - Format a number with locale-specific grouping
-
formatPercent(
double value, {String? locale}) → String - Format as percentage
-
getNestedValue(
String locale, String path) → dynamic - Get nested value from translations
-
getSupportedLocales(
) → List< String> - Get all supported locales
-
hasKey(
String key) → bool - Check if a translation key exists for the current locale
-
isLocaleSupported(
String locale) → bool - Check if a locale is supported
-
isRtl(
{String? rtlSetting}) → bool - Determine if the current locale is RTL When rtlSetting is "auto", uses locale to detect. When "true"/"false", uses the explicit setting.
-
loadLocaleTranslations(
String locale, Map< String, dynamic> translations) → void - Load translations for a specific locale
-
loadTranslations(
Map< String, dynamic> i18nConfig) → Future<void> - Load translations from configuration
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
plural(
String key, int count, {Map< String, dynamic> ? params}) → String - Plural form support
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
resolve(
dynamic value) → dynamic - Resolve a value that might be an i18n key
-
resolveI18nString(
String? value) → String? - Handle i18n key format from MCP UI DSL Format: "i18n:key" or "i18n:key:arg1,arg2"
-
setFallbackLocale(
String locale) → void - Set the fallback locale
-
setLocale(
String locale) → void - Set the current locale
-
toString(
) → String -
A string representation of this object.
inherited
-
translate(
String key, {Map< String, dynamic> ? params}) → String - Get a translated string with dot notation support
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → I18nManager
-
no setter