LocalizedStringExt extension
Extension on String to provide easy access to translation methods.
This extension adds two methods, tr
and trParams
, to the String class,
allowing you to easily translate strings within the Flutter application using
the LocalizationManager
provided by the LocalizationProvider
. These methods facilitate
obtaining localized text, which is essential for supporting multiple languages in the app.
- on
Methods
-
tr(
[BuildContext? context]) → String -
Translates the string key using the
LocalizationManager
from the provided context. -
trParams(
Map< String, dynamic> namedArgs, [BuildContext? context]) → String -
Translates the string key with parameters using the
LocalizationManager
from the provided context. -
trPlural(
int count, [BuildContext? context]) → String