L10nContext extension

Convenience extension on BuildContext for quick string lookups.

// Inside a build() method:
Text(context.t('ui.start_game'))
Text(context.tr('game.hp', {'current': 80, 'max': 100}))
on

Methods

t(String key, [Map<String, Object?> args = const {}]) → String

Available on BuildContext, provided by the L10nContext extension

Looks up key in the nearest LocalizationScope; without one, gives key itself (with args filled in).
tr(String key, Map<String, Object?> args) → String

Available on BuildContext, provided by the L10nContext extension

Looks up key with args.