Skip to content

Commit

Permalink
fix(ui_localizations): localize weak password error (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
lesnitsky committed Oct 12, 2023
1 parent 80e0c85 commit bcfa2be
Show file tree
Hide file tree
Showing 47 changed files with 225 additions and 74 deletions.
2 changes: 2 additions & 0 deletions packages/firebase_ui_auth/lib/src/widgets/error_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ String? localizedErrorText(
return labels.credentialAlreadyInUseErrorText;
case 'invalid-verification-code':
return labels.invalidVerificationCodeErrorText;
case 'weak-password':
return labels.weakPasswordErrorText;

default:
return null;
Expand Down
52 changes: 0 additions & 52 deletions packages/firebase_ui_localizations/bin/gen_l10n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ void main() async {
licenseHeader,
);

await generateLanguagesList(labelsByLocale, licenseHeader);
Process.runSync('dart', ['format', outDir.path]);
}

Expand Down Expand Up @@ -150,57 +149,6 @@ Future<void> generateLocalizationsClass({
await out.close();
}

Future<void> generateLanguagesList(
Map<String, dynamic> arb,
String licenseHeader,
) async {
final outFile = File(
path.join(outDir.path, 'all_languages.dart'),
);

if (!outFile.existsSync()) {
outFile.createSync(recursive: true);
}

final out = outFile.openWrite();

out.writeln(licenseHeader);
out.writeln('import "./default_localizations.dart";');
out.writeln();

for (var entry in arb.entries) {
final locale = entry.key;
final countryCodes = entry.value.keys.where((e) => e != 'default').toList();

final filename = dartFilename(locale);
out.writeln("import 'lang/$filename';");

for (var countryCode in countryCodes) {
out.writeln("import 'lang/${dartFilename(locale, countryCode)}';");
}
}

out.writeln();
out.writeln('final localizations = <String, FirebaseUILocalizationLabels>{');

for (var entry in arb.entries) {
final locale = entry.key;
final countryCodes = entry.value.keys.where((e) => e != 'default').toList();

out.writeln(" '$locale': const ${dartClassName(locale)}(),");

for (var countryCode in countryCodes) {
final key = '${locale}_${countryCode.toLowerCase()}';
out.writeln(" '$key': const ${dartClassName(locale, countryCode)}(),");
}
}

out.writeln('};');

await out.flush();
await out.close();
}

extension StringExtension on String {
String capitalize() {
return "${this[0].toUpperCase()}${substring(1)}";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "ar",
"@@last_modified": "2023-09-22T14:51:00.799791",
"@@last_modified": "2023-10-12T15:27:44.517152",
"accessDisabledErrorText": "تم إيقاف إذن الوصول إلى هذا الحساب مؤقتًا.",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "de",
"@@last_modified": "2023-09-22T14:51:00.791691",
"@@last_modified": "2023-10-12T15:27:44.513540",
"accessDisabledErrorText": "Der Zugriff auf dieses Konto wurde vorübergehend gesperrt",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "en",
"@@last_modified": "2023-09-22T14:51:00.803227",
"@@last_modified": "2023-10-12T15:27:44.518427",
"accessDisabledErrorText": "Access to this account has been temporarily disabled",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "es",
"@@last_modified": "2023-09-22T14:51:00.770278",
"@@last_modified": "2023-10-12T15:27:44.501153",
"accessDisabledErrorText": "Se ha inhabilitado temporalmente al acceso a esta cuenta",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "es_419",
"@@last_modified": "2023-09-22T14:51:00.796492",
"@@last_modified": "2023-10-12T15:27:44.515829",
"accessDisabledErrorText": "Se inhabilitó temporalmente el acceso a la cuenta",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "fr",
"@@last_modified": "2023-09-22T14:51:00.803883",
"@@last_modified": "2023-10-12T15:27:44.520556",
"accessDisabledErrorText": "L'accès à ce compte a été temporairement désactivé",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "he",
"@@last_modified": "2023-09-22T14:51:00.794005",
"@@last_modified": "2023-10-12T15:27:44.509494",
"accessDisabledErrorText": "הגישה לחשבון זה הושבתה באופן זמני",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "hi",
"@@last_modified": "2023-09-22T14:51:00.804545",
"@@last_modified": "2023-10-12T15:27:44.531280",
"accessDisabledErrorText": "इस खाते के ऐक्सेस पर, कुछ समय के लिए रोक लगा दी गई है",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "hu",
"@@last_modified": "2023-09-22T14:51:00.788762",
"@@last_modified": "2023-10-12T15:27:44.527227",
"accessDisabledErrorText": "A fiók átmenetileg le van tiltva",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "id",
"@@last_modified": "2023-09-22T14:51:00.789989",
"@@last_modified": "2023-10-12T15:27:44.525126",
"accessDisabledErrorText": "Akses ke akun ini telah dinonaktifkan untuk sementara waktu",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "it",
"@@last_modified": "2023-09-22T14:51:00.786835",
"@@last_modified": "2023-10-12T15:27:44.529631",
"accessDisabledErrorText": "L'accesso a questo account è stato temporaneamente disabilitato",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "ja",
"@@last_modified": "2023-09-22T14:51:00.805274",
"@@last_modified": "2023-10-12T15:27:44.526360",
"accessDisabledErrorText": "このアカウントへのアクセスが一時的に無効になっています",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "ko",
"@@last_modified": "2023-09-22T14:51:00.778413",
"@@last_modified": "2023-10-12T15:27:44.523502",
"accessDisabledErrorText": "이 계정의 액세스가 일시적으로 중지되었습니다.",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "nl",
"@@last_modified": "2023-09-22T14:51:00.800987",
"@@last_modified": "2023-10-12T15:27:44.530523",
"accessDisabledErrorText": "De toegang tot dit account is tijdelijk uitgezet",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "pl",
"@@last_modified": "2023-09-22T14:51:00.802556",
"@@last_modified": "2023-10-12T15:27:44.532029",
"accessDisabledErrorText": "Dostęp do tego konta został tymczasowo wyłączony",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "pt",
"@@last_modified": "2023-09-22T14:51:00.784012",
"@@last_modified": "2023-10-12T15:27:44.533657",
"accessDisabledErrorText": "O acesso a esta conta foi desativado temporariamente",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "ru",
"@@last_modified": "2023-09-22T14:51:00.806043",
"@@last_modified": "2023-10-12T15:27:44.532762",
"accessDisabledErrorText": "Доступ к этому аккаунту временно заблокирован.",
"@accessDisabledErrorText": {
"description": "Used as an error message when account is blocked and user tries to perform some actions with the account (e.g. unlinking a credential).",
Expand Down Expand Up @@ -508,5 +508,10 @@
"@unlinkProviderAlertMessage": {
"description": "Text that is shown as a message of the AlertDialog confirming provider unlink",
"placeholders": {}
},
"weakPasswordErrorText": "Password should be at least 6 characters",
"@weakPasswordErrorText": {
"description": "Error text suggesting that used password is too weak",
"placeholders": {}
}
}

0 comments on commit bcfa2be

Please sign in to comment.