Skip to content

feat(ui_storage, ui_localizations): add UploadButton label #86

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

Merged
merged 4 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions packages/firebase_ui_localizations/bin/add_label.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Copyright 2023, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:convert';
import 'dart:io';

import 'package:path/path.dart' as path;

String prompt(String tag) {
stdout.write('$tag?: ');
final answer = stdin.readLineSync();

if (answer == null || answer.isEmpty) {
throw Exception('$tag is required');
}

return answer;
}

Future<void> main(List<String> args) async {
final name = prompt('Label name');
final description = prompt('Label description');
final englishTranslation = prompt('English translation');

final cwd = Directory.current.path;
final l10nSrc = Directory(path.join(cwd, 'lib', 'l10n'));

final files = l10nSrc.listSync().whereType<File>().toList();
final futures = files.map((e) async {
final newContent = await addLabel(e, name, description, englishTranslation);
final b = StringBuffer();
final string = const JsonEncoder.withIndent(' ').convert(newContent);
b.write(string);
b.write('\n');

await e.writeAsString(b.toString());
});

await Future.wait(futures);
stdout.writeln('Done!');
}

Future<Map<String, dynamic>> addLabel(
File file,
String name,
String description,
String englishTranslation,
) async {
final content = jsonDecode(await file.readAsString()) as Map<String, dynamic>;
return {
...content,
"@@last_modified": DateTime.now().toIso8601String(),
name: englishTranslation,
"@$name": {
"description": description,
"placeholders": {},
},
};
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "ar",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.840754",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "de",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.835367",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "en",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.843264",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "es",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.812582",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "es_419",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.840098",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "fr",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.846260",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "he",
"@@last_modified": "2023-03-28T13:23:39.449",
"@@last_modified": "2023-08-31T15:49:19.833349",
"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 @@ -31,7 +31,7 @@
"description": "Used as an error text when provided passwords do not match.",
"placeholders": {}
},
"confirmPasswordInputLabel": "וודא סיסמה",
"confirmPasswordInputLabel": "וודא סיסמה",
"@confirmPasswordInputLabel": {
"description": "Used as a label of the PasswordInput that confirms a provided password.",
"placeholders": {}
Expand Down Expand Up @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "hi",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.845305",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "hu",
"@@last_modified": "2022-12-14T10:50:43",
"@@last_modified": "2023-08-31T15:49:19.825507",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "id",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.827378",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "it",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.834393",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "ja",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.843967",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "ko",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.820707",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "nl",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.842616",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "pl",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.841548",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "pt",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.829447",
"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 @@ -423,5 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"@@locale": "ru",
"@@last_modified": "2022-09-14T18:25:39.449",
"@@last_modified": "2023-08-31T15:49:19.845798",
"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 @@ -423,6 +423,10 @@
"@wrongOrNoPasswordErrorText": {
"description": "Used as an error text of the PasswordInput when provided password is empty or is not correct.",
"placeholders": {}
},
"uploadButtonText": "Upload file",
"@uploadButtonText": {
"description": "UploadButton label",
"placeholders": {}
}
}

Loading