More strings to resource

This commit is contained in:
Neeraj Gupta 2021-08-17 14:04:56 +05:30
parent ebd6efd3fe
commit 64760fd52d
5 changed files with 39 additions and 20 deletions

View file

@ -1,9 +1,11 @@
{
"de": [
"ok",
"oops",
"start_backup",
"auth_session_expired",
"auth_login_again",
"auth_logging_out"
"auth_logging_out",
"email_already_claimed"
]
}

View file

@ -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
untranslated-messages-file: l10n-missing-translation.json

View file

@ -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"
}

View file

@ -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();
}

View file

@ -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<SharingDialog> {
"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) {