0 purchases
translatebebasan
translatebebasan #
translatebebasan is Use for make your application multi-language with easily implementation
Example #
And open this to see example here
Using #
Multiple Language in application #
Create a Map for each language that will be declared like this
Map<String, String> en_US = {
'hallo_world': 'Hallo World',
'text_home': 'You have pushed the button this many times:',
'title': 'Flutter Demo',
};
Map<String, String> id_ID = {
'hallo_world': 'Halo Dunia',
'text_home': 'Anda telah menekan tombol ini sebanyak: ',
'title': 'Flutter pratinjau',
};
copied to clipboard
And mapping map to class abstrac in glosarium and add supported language. In list supportedlocales first element is use as default locales
class LanguageService extends Glosarium {
@override
Map<String, Map<String, String>> get keys => {
'id_ID': id_ID,
'en_US': en_US,
};
@override
List<Locale> get supportedLocales => const [
Locale('id', 'ID'),
Locale('en', 'US'),
];
}
copied to clipboard
In main added binding LocalesBasan().addGlosarium(LanguageService());
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await LocalesBasan().addGlosarium(LanguageService());
runApp(MyApp());
}
copied to clipboard
And trala you just add in String .gr
Text(
'text_home'.gr,
),
copied to clipboard
Issues #
Please file any issues, bugs or feature request here.
License #
This project is licensed under the MIT License
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.