AppLocalizations class
Localization / i18n framework for the design system.
Provides a lightweight, composable translation system with pluralization, interpolation, date/number formatting and RTL awareness.
final AppLocalizations loc = AppLocalizations.of(context);
Text(loc.translate('greeting', name: 'World'))
Constructors
-
AppLocalizations({required Locale locale, required Map<
String, dynamic> translations, Locale fallbackLocale = const Locale('en')}) -
const
Properties
- fallbackLocale → Locale
-
Fallback locale when a key is missing.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- locale → Locale
-
The current locale.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
translations
→ Map<
String, dynamic> -
Translation map: key → translated string or nested map.
final
Methods
-
formatCompact(
num value) → String - Formats a compact number (e.g. 1.2K, 3.4M).
-
formatCurrency(
num value, {String? symbol, int decimalDigits = 2}) → String - Formats currency with a symbol.
-
formatDate(
DateTime date, {String pattern = 'yMMMd'}) → String - Formats a date.
-
formatNumber(
num value, {int? decimalDigits}) → String - Formats a number according to the current locale.
-
formatTime(
DateTime date) → String - Formats time.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
plural(
String key, int count, {Map< String, String> ? params}) → String -
Translates and pluralizes based on
count. -
t(
String key, {Map< String, String> ? params}) → String - Alias for translate.
-
toString(
) → String -
A string representation of this object.
inherited
-
translate(
String key, {Map< String, String> ? params}) → String -
Translates
keywith optionalparamsinterpolation.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
maybeOf(
BuildContext context) → AppLocalizations? - Whether translations exist for the current locale.
-
of(
BuildContext context) → AppLocalizations - Inherited lookup from BuildContext.