Last updated:
0 purchases
localaze
Provides ability to translate Json files to localized texts in a variety of languages.
Run time localization for Flutter|Dart applications.
How to use: #
import the package
import 'package:localaze/localaze.dart';
copied to clipboard
Create a map of localized texts, or use json you fetched from the server.
final targetMap1 = <String, Map<String, String>>{
'en': {
'info_message': 'My name is {name} and I am {age} years old',
},
'az': {
'info_message': 'Mənim adım {name} və mən {age} yaşındayam',
},
};
copied to clipboard
Set configuration and initialize the Localaze instance.
Translator.config = Translator.config.copyWith(
translations: targetMap1,
supportedLanguages: {'en', 'az'},
translationsStructure: TranslationsStructureEnum.languageCodeFirst,
);
copied to clipboard
Set params for dynamic translations.
ParamModel name(String value) => ParamModel(key: 'name', value: value);
ParamModel age(int value) => ParamModel(key: 'age', value: "$value");
copied to clipboard
Use the tr extension method to get the localized text.
print(Translator.translate('welcome_message', 'az', name('John'), age(23)));
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.