Skip to content

Commit

Permalink
refactor(deriv_localizations): [UPM-925] Updating passkeys strings in…
Browse files Browse the repository at this point in the history
… deriv localizations (#568)
  • Loading branch information
bassam-deriv authored May 7, 2024
1 parent 711abee commit 3c8cabd
Show file tree
Hide file tree
Showing 5 changed files with 229 additions and 98 deletions.
2 changes: 1 addition & 1 deletion packages/deriv_localizations/l10n.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


# Directories containing ARB files
feature_dirs=( "deriv_auth" "deriv_passkeys" )
feature_dirs=("deriv_auth" "deriv_passkeys")

# Base localization directory
base_l10n_dir="lib/l10n"
Expand Down
31 changes: 20 additions & 11 deletions packages/deriv_localizations/lib/l10n/deriv_passkeys/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,25 @@
"unexpectedError": "An unexpected error occurred!",
"unexpectedErrorDescription": "Please try again later.",
"ok": "Ok",
"createPassKey": "Create Passkey",
"experienceSaferLogins": "Experience safer logins",
"enhanceSecurity": "To enhance your security, tap Create passkey",
"enhanceSecurity": "Enhanced security is just a tap away.",
"here": "here",
"effortlessLogin": "Effortless login with passkeys",
"whatArePasskeys": "What are passkeys?",
"whatArePasskeysDescription": "Passkeys are a security measure that lets you log in the same way you unlock your device: with a fingerprint, a face scan, or a screen lock PIN.",
"whatArePasskeysDescriptionPoint1": "Secure alternative to passwords.",
"whatArePasskeysDescriptionPoint2": "Unlock your account like your phone - with biometrics, face scan or PIN.",
"whyPasskeys": "Why passkeys?",
"whyPasskeysDescription": "Passkeys are an added layer of security that protects your account against unauthorised access and phishing attacks.",
"whyPasskeysDescription1": "Extra security layer.",
"whyPasskeysDescription2": "Shields against unauthorised access and phishing.",
"howToCreatePasskey": "How to create a passkey?",
"howToCreatePasskeyDescription": "Go to ‘Account Settings’ to set up your passkey. Each device can only save one passkey; however, iOS users may still see the \"Create passkey\" button due to iOS’s ability to save passkeys on other devices.",
"howToCreatePasskeyDescription1": "Go to ‘Account Settings’ on Deriv.",
"howToCreatePasskeyDescription2": "You can create one passkey per device.",
"whereArePasskeysSaved": "Where are passkeys saved?",
"whereArePasskeysSavedDescription": "Passkeys are saved in your Google password manager for Android devices and in iCloud keychain on iOS devices to help you sign in on other devices.",
"whereArePasskeysSavedDescriptionAndroid": "Android: Google password manager.",
"whereArePasskeysSavedDescriptionIOS": "iOS: iCloud keychain.",
"whatHappensIfEmailChanged": "What happens if my Deriv account email is changed?",
"whatHappensIfEmailChangedDescription": "Even if you change your email address, you can still continue to log in to your Deriv account with the same passkey.",
"whatHappensIfEmailChangedDescription1": "No problem! Your passkey still works.",
"whatHappensIfEmailChangedDescription2": "Sign in to Deriv with your existing passkey.",
"tips": "Tips",
"beforeUsingPasskeys": "Before using passkeys",
"enableScreenLock": "Enable screen lock on your device.",
Expand All @@ -40,11 +44,16 @@
"learnMoreAboutPasskeys": "Learn more about passkeys",
"noNeedToRememberPassword": "No need to remember a password",
"useYourBiometrics": "Enhanced security with biometrics or screen lock",
"syncAcrossAllDevices": "Sync across all devices",
"createPasskey": "Create Passkey",
"syncAcrossDevices": "Sync across devices",
"createPasskey": "Create passkey",
"unsupportedPlatform": "Unsupported Platform",
"storedOn": "Stored on",
"lastUsed": "Last used",
"rename": "Rename",
"revoke": "Revoke"
}
"revoke": "Revoke",
"continueTradingButtonText": "Continue Trading",
"addMorePasskeysButtonText": "Add More Passkeys",
"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"
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,18 @@ 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)!;
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 @@ -95,7 +98,8 @@ 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 @@ -652,49 +656,83 @@ 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.');
}
Loading

0 comments on commit 3c8cabd

Please sign in to comment.