Skip to content

Commit

Permalink
Update localizations
Browse files Browse the repository at this point in the history
  • Loading branch information
bassam-deriv committed May 14, 2024
1 parent 262d1a9 commit 30c9ffd
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@
"unableToSetupPasskey": "Unable to setup passkey",
"unableToSetupPasskeyDescription": "We encountered an issue while setting up your passkey. The process might have been interrupted, or the session timed out. Please try again.",
"passkeysOffErrorTitle": "The Passkeys service is unavailable",
"never": "Never"
"never": "Never",
"unable_to_process_your_request": "Unable to process your request"
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<DerivAuthLocalizations>(
context, DerivAuthLocalizations)!;
static DerivAuthLocalizations? of(BuildContext context) {
return Localizations.of<DerivAuthLocalizations>(context, DerivAuthLocalizations);
}

static const LocalizationsDelegate<DerivAuthLocalizations> delegate =
_DerivAuthLocalizationsDelegate();
static const LocalizationsDelegate<DerivAuthLocalizations> delegate = _DerivAuthLocalizationsDelegate();

/// A list of this localizations delegate along with the default localizations
/// delegates.
Expand All @@ -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<LocalizationsDelegate<dynamic>> localizationsDelegates =
<LocalizationsDelegate<dynamic>>[
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
Expand Down Expand Up @@ -656,83 +652,49 @@ abstract class DerivAuthLocalizations {
String get labelLanguage;
}

class _DerivAuthLocalizationsDelegate
extends LocalizationsDelegate<DerivAuthLocalizations> {
class _DerivAuthLocalizationsDelegate extends LocalizationsDelegate<DerivAuthLocalizations> {
const _DerivAuthLocalizationsDelegate();

@override
Future<DerivAuthLocalizations> load(Locale locale) {
return SynchronousFuture<DerivAuthLocalizations>(
lookupDerivAuthLocalizations(locale));
return SynchronousFuture<DerivAuthLocalizations>(lookupDerivAuthLocalizations(locale));
}

@override
bool isSupported(Locale locale) => <String>[
'ar',
'bn',
'de',
'en',
'es',
'fr',
'it',
'ko',
'pl',
'pt',
'ru',
'si',
'sw',
'th',
'tr',
'vi',
'zh'
].contains(locale.languageCode);
bool isSupported(Locale locale) => <String>['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.'
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<DerivPasskeysLocalizations>(
context, DerivPasskeysLocalizations)!;
static DerivPasskeysLocalizations? of(BuildContext context) {
return Localizations.of<DerivPasskeysLocalizations>(context, DerivPasskeysLocalizations);
}

static const LocalizationsDelegate<DerivPasskeysLocalizations> delegate =
_DerivPasskeysLocalizationsDelegate();
static const LocalizationsDelegate<DerivPasskeysLocalizations> delegate = _DerivPasskeysLocalizationsDelegate();

/// A list of this localizations delegate along with the default localizations
/// delegates.
Expand All @@ -82,16 +79,17 @@ 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<LocalizationsDelegate<dynamic>> localizationsDelegates =
<LocalizationsDelegate<dynamic>>[
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
delegate,
GlobalMaterialLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
];

/// A list of this localizations delegate's supported locales.
static const List<Locale> supportedLocales = <Locale>[Locale('en')];
static const List<Locale> supportedLocales = <Locale>[
Locale('en')
];

/// No description provided for @passkeyCreatedSuccessTitle.
///
Expand Down Expand Up @@ -392,36 +390,41 @@ abstract class DerivPasskeysLocalizations {
/// In en, this message translates to:
/// **'Never'**
String get never;

/// No description provided for @unable_to_process_your_request.
///
/// In en, this message translates to:
/// **'Unable to process your request'**
String get unable_to_process_your_request;
}

class _DerivPasskeysLocalizationsDelegate
extends LocalizationsDelegate<DerivPasskeysLocalizations> {
class _DerivPasskeysLocalizationsDelegate extends LocalizationsDelegate<DerivPasskeysLocalizations> {
const _DerivPasskeysLocalizationsDelegate();

@override
Future<DerivPasskeysLocalizations> load(Locale locale) {
return SynchronousFuture<DerivPasskeysLocalizations>(
lookupDerivPasskeysLocalizations(locale));
return SynchronousFuture<DerivPasskeysLocalizations>(lookupDerivPasskeysLocalizations(locale));
}

@override
bool isSupported(Locale locale) =>
<String>['en'].contains(locale.languageCode);
bool isSupported(Locale locale) => <String>['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.'
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,7 @@ class DerivPasskeysLocalizationsEn extends DerivPasskeysLocalizations {

@override
String get never => 'Never';

@override
String get unable_to_process_your_request => 'Unable to process your request';
}

0 comments on commit 30c9ffd

Please sign in to comment.