Skip to content

Instantly share code, notes, and snippets.

@hitherejoe
Last active August 28, 2018 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hitherejoe/820c2df169f4566cf3386f92df939e69 to your computer and use it in GitHub Desktop.
Save hitherejoe/820c2df169f4566cf3386f92df939e69 to your computer and use it in GitHub Desktop.
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