Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Last active Aug 28, 2018
Embed
What would you like to do?
class AppLocalizations {
static Future<AppLocalizations> load(Locale locale) {
final String name =
locale.countryCode.isEmpty ? locale.languageCode : locale.toString();
final String localeName = Intl.canonicalizedLocale(name);
return initializeMessages(localeName).then((bool _) {
Intl.defaultLocale = localeName;
return new AppLocalizations();
});
}
static AppLocalizations of(BuildContext context) =>
Localizations.of<AppLocalizations>(context, AppLocalizations);
String get applicationTitle =>
Intl.message('HashTrack',
name: 'applicationTitle', desc: 'The application title');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment