We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thanks for this great package.
How can make it work with Flutter's Intl package?
I am trying to give the manual toggle in the app for language change, and want the locale with this package to auto update. Please help!
Code of my localization dart files:
app_localization.dart
import 'package:flutter/material.dart'; import 'package:intl/intl.dart'; import 'package:praja/l10n/messages_all.dart'; class AppLocalization { static String localeName = "en"; static Future<AppLocalization> load(Locale locale) { final String name = locale.countryCode.isEmpty ? locale.languageCode : locale.toString(); localeName = Intl.canonicalizedLocale(name); return initializeMessages(localeName).then((_) { Intl.defaultLocale = localeName; return AppLocalization(); }); } static AppLocalization of(BuildContext context) { return Localizations.of<AppLocalization>(context, AppLocalization); } // list of locales String get heyWorld { return Intl.message( 'Hey World', name: 'heyWorld', desc: 'Simple word for greeting ', ); } }
app_localization_delegate.dart
import 'package:flutter/material.dart'; import 'package:praja/locale/app_localization.dart'; class AppLocalizationDelegate extends LocalizationsDelegate<AppLocalization> { final Locale overriddenLocale; const AppLocalizationDelegate(this.overriddenLocale); @override bool isSupported(Locale locale) => ['en', 'te'].contains(locale.languageCode); @override Future<AppLocalization> load(Locale locale) => AppLocalization.load(locale); @override bool shouldReload(LocalizationsDelegate<AppLocalization> old) => false; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Thanks for this great package.
How can make it work with Flutter's Intl package?
I am trying to give the manual toggle in the app for language change, and want the locale with this package to auto update.
Please help!
Code of my localization dart files:
app_localization.dart
app_localization_delegate.dart
The text was updated successfully, but these errors were encountered: