TextTranslateExtension extension
Text widget extension method for access to tr() and plural() Example :
Text('title').tr()
Text('day').plural(21)
- on
Methods
-
plural(
num value, {BuildContext? context, List< String> ? args, Map<String, String> ? namedArgs, String? name, NumberFormat? format}) → Text -
function translate with pluralization
key Localization key
value
Number value for pluralization BuildContext The location in the tree where this widget buildsargs
List of localized strings. Replaces {} left to rightnamedArgs
Map of localized strings. Replaces the name keys {key_name} according to its namename
Name of number value. Replaces {$name} to valueformat
Formats a numeric value using a NumberFormat class -
tr(
{List< String> ? args, BuildContext? context, Map<String, String> ? namedArgs, String? gender}) → Text -
Main function for translate your language keys
key Localization key
BuildContext The location in the tree where this widget builds
args
List of localized strings. Replaces {} left to rightnamedArgs
Map of localized strings. Replaces the name keys {key_name} according to its namegender
Gender switcher. Changes the localized string based on gender string