Skip to content
New issue

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

feat(deriv_localizations): [UPM-856] Adding deriv passkeys localizations. #544

Merged
Merged
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")
feature_dirs=("deriv_auth", "deriv_passkeys")

# Base localization directory
base_l10n_dir="lib/l10n"
Expand Down
50 changes: 50 additions & 0 deletions packages/deriv_localizations/lib/l10n/deriv_passkeys/app_en.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"passkeyCreatedSuccessTitle": "Success!",
"passkeyCreatedSuccessMessage": "Your account is now secured with a passkey. Manage your passkey through your {platformName} account settings.",
"@passkeyCreatedSuccessMessage": {
"placeholders": {
"platformName": {
"required": true,
"type": "String"
}
}
},
"continueButtonText": "Continue",
"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",
"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.",
"whyPasskeys": "Why passkeys?",
"whyPasskeysDescription": "Passkeys are an added layer of security that protects your account against unauthorised access and phishing attacks.",
"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.",
"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.",
"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.",
"tips": "Tips",
"beforeUsingPasskeys": "Before using passkeys",
"enableScreenLock": "Enable screen lock on your device.",
"signInGoogleOrIcloud": "Sign in to your Google or iCloud account.",
"enableBluetooth": "Enable Bluetooth.",
"noPasskeyFound": "No passkey found!",
"noPasskeyFoundDescription": "Please create a passkey to use this feature.",
"maybeLater": "Maybe later",
"effortlessLoginWithPasskeys": "Effortless login with passkeys",
"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",
"unsupportedPlatform": "Unsupported Platform",
"storedOn": "Stored on",
"lastUsed": "Last used",
"rename": "Rename",
"revoke": "Revoke"
}
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 @@ -646,49 +650,83 @@ abstract class DerivAuthLocalizations {
String get warnInvalidApplicationID;
}

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
Loading