diff --git a/l10n-missing-translation.json b/l10n-missing-translation.json index af188528c..2fdd7d6a5 100644 --- a/l10n-missing-translation.json +++ b/l10n-missing-translation.json @@ -1,9 +1,11 @@ { "de": [ "ok", + "oops", "start_backup", "auth_session_expired", "auth_login_again", - "auth_logging_out" + "auth_logging_out", + "email_already_claimed" ] } diff --git a/l10n.yaml b/l10n.yaml index 1e1811927..ef392b763 100644 --- a/l10n.yaml +++ b/l10n.yaml @@ -1,4 +1,4 @@ arb-dir: lib/l10n template-arb-file: app_en.arb output-localization-file: app_localizations.dart -untranslated-messages-file: l10n-missing-translation.json \ No newline at end of file +untranslated-messages-file: l10n-missing-translation.json diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arb index 390d604fd..42a6f0551 100644 --- a/lib/l10n/app_en.arb +++ b/lib/l10n/app_en.arb @@ -5,8 +5,13 @@ }, "log_in": "log in", "ok": "ok", - "start_backup" : "start backup", + "oops": "oops", + "@oops": { + "description": "Usage: 'oops, I'm sorry!' or 'oops, verification failed'" + }, + "start_backup": "start backup", "auth_session_expired": "session expired", "auth_login_again": "please login again", - "auth_logging_out": "logging out..." + "auth_logging_out": "logging out...", + "email_already_claimed": "this email is already in use" } diff --git a/lib/services/user_service.dart b/lib/services/user_service.dart index 1de9f5b15..dc5e9b4f0 100644 --- a/lib/services/user_service.dart +++ b/lib/services/user_service.dart @@ -28,7 +28,7 @@ import 'package:photos/utils/crypto_util.dart'; import 'package:photos/utils/dialog_util.dart'; import 'package:photos/utils/navigation_util.dart'; import 'package:photos/utils/toast_util.dart'; - +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class UserService { final _dio = Network.instance.getDio(); final _logger = Logger("UserAuthenticator"); @@ -71,7 +71,8 @@ class UserService { } on DioError catch (e) { await dialog.hide(); if (e.response != null && e.response.statusCode == 403) { - showErrorDialog(context, "oops", "this email is already in use"); + showErrorDialog(context, AppLocalizations.of(context).oops, + AppLocalizations.of(context).email_already_claimed); } else { showGenericErrorDialog(context); } @@ -179,13 +180,14 @@ class UserService { (route) => route.isFirst, ); } else { - showErrorDialog( - context, "oops", "verification failed, please try again"); + showErrorDialog(context, AppLocalizations.of(context).oops, + "verification failed, please try again"); } } catch (e) { await dialog.hide(); _logger.severe(e); - showErrorDialog(context, "oops", "verification failed, please try again"); + showErrorDialog(context, AppLocalizations.of(context).oops, + "verification failed, please try again"); } } @@ -217,11 +219,13 @@ class UserService { Bus.instance.fire(EmailChangedEvent()); return; } - showErrorDialog(context, "oops", "verification failed, please try again"); + showErrorDialog(context, AppLocalizations.of(context).oops, + "verification failed, please try again"); } on DioError catch (e) { await dialog.hide(); if (e.response != null && e.response.statusCode == 403) { - showErrorDialog(context, "oops", "this email is already in use"); + showErrorDialog(context, AppLocalizations.of(context).oops, + AppLocalizations.of(context).email_already_claimed); } else { showErrorDialog(context, "incorrect code", "authentication failed, please try again"); @@ -229,7 +233,8 @@ class UserService { } catch (e) { await dialog.hide(); _logger.severe(e); - showErrorDialog(context, "oops", "verification failed, please try again"); + showErrorDialog(context, AppLocalizations.of(context).oops, + "verification failed, please try again"); } } @@ -352,7 +357,8 @@ class UserService { await dialog.hide(); _logger.severe(e); showErrorDialog( - context, "oops", "authentication failed, please try again"); + context, AppLocalizations.of(context).oops, + "authentication failed, please try again"); } } @@ -393,12 +399,14 @@ class UserService { ); } else { showErrorDialog( - context, "oops", "something went wrong, please try again"); + context, AppLocalizations.of(context).oops, + "something went wrong, please try again"); } } catch (e) { _logger.severe(e); showErrorDialog( - context, "oops", "something went wrong, please try again"); + context, AppLocalizations.of(context).oops, + "something went wrong, please try again"); } finally { await dialog.hide(); } @@ -459,12 +467,14 @@ class UserService { ); } else { showErrorDialog( - context, "oops", "something went wrong, please try again"); + context, AppLocalizations.of(context).oops, + "something went wrong, please try again"); } } catch (e) { _logger.severe(e); showErrorDialog( - context, "oops", "something went wrong, please try again"); + context, AppLocalizations.of(context).oops, + "something went wrong, please try again"); } finally { await dialog.hide(); } diff --git a/lib/ui/share_collection_widget.dart b/lib/ui/share_collection_widget.dart index fef5af540..c11d43502 100644 --- a/lib/ui/share_collection_widget.dart +++ b/lib/ui/share_collection_widget.dart @@ -18,6 +18,7 @@ import 'package:photos/utils/dialog_util.dart'; import 'package:photos/utils/email_util.dart'; import 'package:photos/utils/share_util.dart'; import 'package:photos/utils/toast_util.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; class SharingDialog extends StatefulWidget { final Collection collection; @@ -156,11 +157,12 @@ class _SharingDialogState extends State { "please enter a valid email address."); return; } else if (email == Configuration.instance.getEmail()) { - showErrorDialog(context, "oops", "you cannot share with yourself"); + showErrorDialog(context, AppLocalizations.of(context).oops, + "you cannot share with yourself"); return; } else if (widget.collection.sharees.any((user) => user.email == email)) { - showErrorDialog( - context, "oops", "you're already sharing this with " + email); + showErrorDialog(context, AppLocalizations.of(context).oops, + "you're already sharing this with " + email); return; } if (publicKey == null) {