Pārlūkot izejas kodu

More strings to resource

Neeraj Gupta 3 gadi atpakaļ
vecāks
revīzija
64760fd52d

+ 3 - 1
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"
   ]
 }

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

+ 7 - 2
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"
 }

+ 23 - 13
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();
     }

+ 5 - 3
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<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) {