From 30fb50993b0bebd58fba82b2b16429d9d9cd0af5 Mon Sep 17 00:00:00 2001 From: bassam-deriv Date: Mon, 13 May 2024 08:14:15 +0400 Subject: [PATCH] Update localizations --- .../deriv_auth/deriv_auth_localizations.dart | 102 ++++++------------ .../deriv_passkeys_localizations.dart | 47 ++++---- .../deriv_passkeys_localizations_en.dart | 3 + 3 files changed, 60 insertions(+), 92 deletions(-) diff --git a/packages/deriv_localizations/lib/l10n/generated/deriv_auth/deriv_auth_localizations.dart b/packages/deriv_localizations/lib/l10n/generated/deriv_auth/deriv_auth_localizations.dart index a742191e9..e316f9432 100644 --- a/packages/deriv_localizations/lib/l10n/generated/deriv_auth/deriv_auth_localizations.dart +++ b/packages/deriv_localizations/lib/l10n/generated/deriv_auth/deriv_auth_localizations.dart @@ -75,18 +75,15 @@ import 'deriv_auth_localizations_zh.dart'; /// be consistent with the languages listed in the DerivAuthLocalizations.supportedLocales /// property. abstract class DerivAuthLocalizations { - DerivAuthLocalizations(String locale) - : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + DerivAuthLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString()); final String localeName; - static DerivAuthLocalizations of(BuildContext context) { - return Localizations.of( - context, DerivAuthLocalizations)!; + static DerivAuthLocalizations? of(BuildContext context) { + return Localizations.of(context, DerivAuthLocalizations); } - static const LocalizationsDelegate delegate = - _DerivAuthLocalizationsDelegate(); + static const LocalizationsDelegate delegate = _DerivAuthLocalizationsDelegate(); /// A list of this localizations delegate along with the default localizations /// delegates. @@ -98,8 +95,7 @@ abstract class DerivAuthLocalizations { /// Additional delegates can be added by appending to this list in /// MaterialApp. This list does not have to be used at all if a custom list /// of delegates is preferred or required. - static const List> localizationsDelegates = - >[ + static const List> localizationsDelegates = >[ delegate, GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, @@ -656,83 +652,49 @@ abstract class DerivAuthLocalizations { String get labelLanguage; } -class _DerivAuthLocalizationsDelegate - extends LocalizationsDelegate { +class _DerivAuthLocalizationsDelegate extends LocalizationsDelegate { const _DerivAuthLocalizationsDelegate(); @override Future load(Locale locale) { - return SynchronousFuture( - lookupDerivAuthLocalizations(locale)); + return SynchronousFuture(lookupDerivAuthLocalizations(locale)); } @override - bool isSupported(Locale locale) => [ - 'ar', - 'bn', - 'de', - 'en', - 'es', - 'fr', - 'it', - 'ko', - 'pl', - 'pt', - 'ru', - 'si', - 'sw', - 'th', - 'tr', - 'vi', - 'zh' - ].contains(locale.languageCode); + bool isSupported(Locale locale) => ['ar', 'bn', 'de', 'en', 'es', 'fr', 'it', 'ko', 'pl', 'pt', 'ru', 'si', 'sw', 'th', 'tr', 'vi', 'zh'].contains(locale.languageCode); @override bool shouldReload(_DerivAuthLocalizationsDelegate old) => false; } DerivAuthLocalizations lookupDerivAuthLocalizations(Locale locale) { + + // Lookup logic when only language code is specified. switch (locale.languageCode) { - case 'ar': - return DerivAuthLocalizationsAr(); - case 'bn': - return DerivAuthLocalizationsBn(); - case 'de': - return DerivAuthLocalizationsDe(); - case 'en': - return DerivAuthLocalizationsEn(); - case 'es': - return DerivAuthLocalizationsEs(); - case 'fr': - return DerivAuthLocalizationsFr(); - case 'it': - return DerivAuthLocalizationsIt(); - case 'ko': - return DerivAuthLocalizationsKo(); - case 'pl': - return DerivAuthLocalizationsPl(); - case 'pt': - return DerivAuthLocalizationsPt(); - case 'ru': - return DerivAuthLocalizationsRu(); - case 'si': - return DerivAuthLocalizationsSi(); - case 'sw': - return DerivAuthLocalizationsSw(); - case 'th': - return DerivAuthLocalizationsTh(); - case 'tr': - return DerivAuthLocalizationsTr(); - case 'vi': - return DerivAuthLocalizationsVi(); - case 'zh': - return DerivAuthLocalizationsZh(); + case 'ar': return DerivAuthLocalizationsAr(); + case 'bn': return DerivAuthLocalizationsBn(); + case 'de': return DerivAuthLocalizationsDe(); + case 'en': return DerivAuthLocalizationsEn(); + case 'es': return DerivAuthLocalizationsEs(); + case 'fr': return DerivAuthLocalizationsFr(); + case 'it': return DerivAuthLocalizationsIt(); + case 'ko': return DerivAuthLocalizationsKo(); + case 'pl': return DerivAuthLocalizationsPl(); + case 'pt': return DerivAuthLocalizationsPt(); + case 'ru': return DerivAuthLocalizationsRu(); + case 'si': return DerivAuthLocalizationsSi(); + case 'sw': return DerivAuthLocalizationsSw(); + case 'th': return DerivAuthLocalizationsTh(); + case 'tr': return DerivAuthLocalizationsTr(); + case 'vi': return DerivAuthLocalizationsVi(); + case 'zh': return DerivAuthLocalizationsZh(); } throw FlutterError( - 'DerivAuthLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' - 'an issue with the localizations generation tool. Please file an issue ' - 'on GitHub with a reproducible sample app and the gen-l10n configuration ' - 'that was used.'); + 'DerivAuthLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' + 'an issue with the localizations generation tool. Please file an issue ' + 'on GitHub with a reproducible sample app and the gen-l10n configuration ' + 'that was used.' + ); } diff --git a/packages/deriv_localizations/lib/l10n/generated/deriv_passkeys/deriv_passkeys_localizations.dart b/packages/deriv_localizations/lib/l10n/generated/deriv_passkeys/deriv_passkeys_localizations.dart index 905611466..b6428a146 100644 --- a/packages/deriv_localizations/lib/l10n/generated/deriv_passkeys/deriv_passkeys_localizations.dart +++ b/packages/deriv_localizations/lib/l10n/generated/deriv_passkeys/deriv_passkeys_localizations.dart @@ -59,18 +59,15 @@ import 'deriv_passkeys_localizations_en.dart'; /// be consistent with the languages listed in the DerivPasskeysLocalizations.supportedLocales /// property. abstract class DerivPasskeysLocalizations { - DerivPasskeysLocalizations(String locale) - : localeName = intl.Intl.canonicalizedLocale(locale.toString()); + DerivPasskeysLocalizations(String locale) : localeName = intl.Intl.canonicalizedLocale(locale.toString()); final String localeName; - static DerivPasskeysLocalizations of(BuildContext context) { - return Localizations.of( - context, DerivPasskeysLocalizations)!; + static DerivPasskeysLocalizations? of(BuildContext context) { + return Localizations.of(context, DerivPasskeysLocalizations); } - static const LocalizationsDelegate delegate = - _DerivPasskeysLocalizationsDelegate(); + static const LocalizationsDelegate delegate = _DerivPasskeysLocalizationsDelegate(); /// A list of this localizations delegate along with the default localizations /// delegates. @@ -82,8 +79,7 @@ abstract class DerivPasskeysLocalizations { /// Additional delegates can be added by appending to this list in /// MaterialApp. This list does not have to be used at all if a custom list /// of delegates is preferred or required. - static const List> localizationsDelegates = - >[ + static const List> localizationsDelegates = >[ delegate, GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, @@ -91,7 +87,9 @@ abstract class DerivPasskeysLocalizations { ]; /// A list of this localizations delegate's supported locales. - static const List supportedLocales = [Locale('en')]; + static const List supportedLocales = [ + Locale('en') + ]; /// No description provided for @passkeyCreatedSuccessTitle. /// @@ -386,36 +384,41 @@ abstract class DerivPasskeysLocalizations { /// In en, this message translates to: /// **'The Passkeys service is unavailable'** String get passkeysOffErrorTitle; + + /// No description provided for @never. + /// + /// In en, this message translates to: + /// **'Never'** + String get never; } -class _DerivPasskeysLocalizationsDelegate - extends LocalizationsDelegate { +class _DerivPasskeysLocalizationsDelegate extends LocalizationsDelegate { const _DerivPasskeysLocalizationsDelegate(); @override Future load(Locale locale) { - return SynchronousFuture( - lookupDerivPasskeysLocalizations(locale)); + return SynchronousFuture(lookupDerivPasskeysLocalizations(locale)); } @override - bool isSupported(Locale locale) => - ['en'].contains(locale.languageCode); + bool isSupported(Locale locale) => ['en'].contains(locale.languageCode); @override bool shouldReload(_DerivPasskeysLocalizationsDelegate old) => false; } DerivPasskeysLocalizations lookupDerivPasskeysLocalizations(Locale locale) { + + // Lookup logic when only language code is specified. switch (locale.languageCode) { - case 'en': - return DerivPasskeysLocalizationsEn(); + case 'en': return DerivPasskeysLocalizationsEn(); } throw FlutterError( - 'DerivPasskeysLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' - 'an issue with the localizations generation tool. Please file an issue ' - 'on GitHub with a reproducible sample app and the gen-l10n configuration ' - 'that was used.'); + 'DerivPasskeysLocalizations.delegate failed to load unsupported locale "$locale". This is likely ' + 'an issue with the localizations generation tool. Please file an issue ' + 'on GitHub with a reproducible sample app and the gen-l10n configuration ' + 'that was used.' + ); } diff --git a/packages/deriv_localizations/lib/l10n/generated/deriv_passkeys/deriv_passkeys_localizations_en.dart b/packages/deriv_localizations/lib/l10n/generated/deriv_passkeys/deriv_passkeys_localizations_en.dart index 18a6fc2c4..5732d45d3 100644 --- a/packages/deriv_localizations/lib/l10n/generated/deriv_passkeys/deriv_passkeys_localizations_en.dart +++ b/packages/deriv_localizations/lib/l10n/generated/deriv_passkeys/deriv_passkeys_localizations_en.dart @@ -152,4 +152,7 @@ class DerivPasskeysLocalizationsEn extends DerivPasskeysLocalizations { @override String get passkeysOffErrorTitle => 'The Passkeys service is unavailable'; + + @override + String get never => 'Never'; }