Browse Source

l10n: Merge strings (#965)

Neeraj Gupta 2 years ago
parent
commit
f3f47c080d

+ 6 - 14
lib/generated/intl/messages_en.dart

@@ -184,10 +184,8 @@ class MessageLookup extends MessageLookupByLibrary {
         "account": MessageLookupByLibrary.simpleMessage("Account"),
         "accountWelcomeBack":
             MessageLookupByLibrary.simpleMessage("Welcome back!"),
-        "ackPasswordLostWarningPart1": MessageLookupByLibrary.simpleMessage(
-            "I understand that if I lose my password, I may lose my data since my data is "),
-        "ackPasswordLostWarningPart2":
-            MessageLookupByLibrary.simpleMessage(" with ente"),
+        "ackPasswordLostWarning": MessageLookupByLibrary.simpleMessage(
+            "I understand that if I lose my password, I may lose my data since my data is <underline>end-to-end encrypted</underline>."),
         "activeSessions":
             MessageLookupByLibrary.simpleMessage("Active sessions"),
         "addANewEmail": MessageLookupByLibrary.simpleMessage("Add a new email"),
@@ -225,7 +223,6 @@ class MessageLookup extends MessageLookupByLibrary {
             MessageLookupByLibrary.simpleMessage("Allow downloads"),
         "allowPeopleToAddPhotos":
             MessageLookupByLibrary.simpleMessage("Allow people to add photos"),
-        "and": MessageLookupByLibrary.simpleMessage("and"),
         "androidIosWebDesktop":
             MessageLookupByLibrary.simpleMessage("Android, iOS, Web, Desktop"),
         "appleId": MessageLookupByLibrary.simpleMessage("Apple ID"),
@@ -295,8 +292,6 @@ class MessageLookup extends MessageLookupByLibrary {
             MessageLookupByLibrary.simpleMessage("Backup settings"),
         "backupVideos": MessageLookupByLibrary.simpleMessage("Backup videos"),
         "blog": MessageLookupByLibrary.simpleMessage("Blog"),
-        "byClickingLogInIAgreeToThe": MessageLookupByLibrary.simpleMessage(
-            "By clicking log in, I agree to the"),
         "cachedData": MessageLookupByLibrary.simpleMessage("Cached data"),
         "calculating": MessageLookupByLibrary.simpleMessage("Calculating..."),
         "canNotUploadToAlbumsOwnedByOthers":
@@ -501,8 +496,6 @@ class MessageLookup extends MessageLookupByLibrary {
         "encryption": MessageLookupByLibrary.simpleMessage("Encryption"),
         "encryptionKeys":
             MessageLookupByLibrary.simpleMessage("Encryption keys"),
-        "endToEndEncrypted":
-            MessageLookupByLibrary.simpleMessage("end-to-end encrypted"),
         "endtoendEncryptedByDefault": MessageLookupByLibrary.simpleMessage(
             "End-to-end encrypted by default"),
         "enteCanEncryptAndPreserveFilesOnlyIfYouGrant":
@@ -685,6 +678,8 @@ class MessageLookup extends MessageLookupByLibrary {
         "lockscreen": MessageLookupByLibrary.simpleMessage("Lockscreen"),
         "logInLabel": MessageLookupByLibrary.simpleMessage("Log in"),
         "loggingOut": MessageLookupByLibrary.simpleMessage("Logging out..."),
+        "loginTerms": MessageLookupByLibrary.simpleMessage(
+            "By clicking log in, I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>"),
         "logout": MessageLookupByLibrary.simpleMessage("Logout"),
         "logsDialogBody": MessageLookupByLibrary.simpleMessage(
             "This will send across logs to help us debug your issue. Please note that file names will be included to help track issues with specific files."),
@@ -806,7 +801,6 @@ class MessageLookup extends MessageLookupByLibrary {
         "pressAndHoldToPlayVideo": MessageLookupByLibrary.simpleMessage(
             "Press and hold to play video"),
         "privacy": MessageLookupByLibrary.simpleMessage("Privacy"),
-        "privacyPolicy": MessageLookupByLibrary.simpleMessage("privacy policy"),
         "privacyPolicyTitle":
             MessageLookupByLibrary.simpleMessage("Privacy Policy"),
         "privateBackups":
@@ -974,6 +968,8 @@ class MessageLookup extends MessageLookupByLibrary {
         "sharedWith": m44,
         "sharedWithMe": MessageLookupByLibrary.simpleMessage("Shared with me"),
         "sharing": MessageLookupByLibrary.simpleMessage("Sharing..."),
+        "signUpTerms": MessageLookupByLibrary.simpleMessage(
+            "I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>"),
         "singleFileDeleteFromDevice": m45,
         "singleFileDeleteHighlight": MessageLookupByLibrary.simpleMessage(
             "It will be deleted from all albums."),
@@ -1040,10 +1036,6 @@ class MessageLookup extends MessageLookupByLibrary {
         "terminateSession":
             MessageLookupByLibrary.simpleMessage("Terminate session?"),
         "terms": MessageLookupByLibrary.simpleMessage("Terms"),
-        "termsAgreePart1":
-            MessageLookupByLibrary.simpleMessage("I agree to the "),
-        "termsOfService":
-            MessageLookupByLibrary.simpleMessage("terms of service"),
         "termsOfServicesTitle": MessageLookupByLibrary.simpleMessage("Terms"),
         "thankYou": MessageLookupByLibrary.simpleMessage("Thank you"),
         "thankYouForSubscribing":

+ 13 - 67
lib/generated/l10n.dart

@@ -770,37 +770,16 @@ class S {
     );
   }
 
-  /// `I understand that if I lose my password, I may lose my data since my data is `
-  String get ackPasswordLostWarningPart1 {
+  /// `I understand that if I lose my password, I may lose my data since my data is <underline>end-to-end encrypted</underline>.`
+  String get ackPasswordLostWarning {
     return Intl.message(
-      'I understand that if I lose my password, I may lose my data since my data is ',
-      name: 'ackPasswordLostWarningPart1',
+      'I understand that if I lose my password, I may lose my data since my data is <underline>end-to-end encrypted</underline>.',
+      name: 'ackPasswordLostWarning',
       desc: '',
       args: [],
     );
   }
 
-  /// `end-to-end encrypted`
-  String get endToEndEncrypted {
-    return Intl.message(
-      'end-to-end encrypted',
-      name: 'endToEndEncrypted',
-      desc: '',
-      args: [],
-    );
-  }
-
-  /// ` with ente`
-  String get ackPasswordLostWarningPart2 {
-    return Intl.message(
-      ' with ente',
-      name: 'ackPasswordLostWarningPart2',
-      desc:
-          'This text is part2 the sentence \'I understand that if I lose my password, I may lose my data since my data is end-to-end encrypted with ente.\'',
-      args: [],
-    );
-  }
-
   /// `Privacy Policy`
   String get privacyPolicyTitle {
     return Intl.message(
@@ -821,43 +800,11 @@ class S {
     );
   }
 
-  /// `I agree to the `
-  String get termsAgreePart1 {
-    return Intl.message(
-      'I agree to the ',
-      name: 'termsAgreePart1',
-      desc:
-          'Note: there\'s a trailing space. This text is part the sentence \'I agree to the terms of service and privacy policy.\'',
-      args: [],
-    );
-  }
-
-  /// `privacy policy`
-  String get privacyPolicy {
-    return Intl.message(
-      'privacy policy',
-      name: 'privacyPolicy',
-      desc: '',
-      args: [],
-    );
-  }
-
-  /// `and`
-  String get and {
+  /// `I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>`
+  String get signUpTerms {
     return Intl.message(
-      'and',
-      name: 'and',
-      desc:
-          'Separator used in sentences like \'I agree to the terms of service and privacy policy.\'',
-      args: [],
-    );
-  }
-
-  /// `terms of service`
-  String get termsOfService {
-    return Intl.message(
-      'terms of service',
-      name: 'termsOfService',
+      'I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>',
+      name: 'signUpTerms',
       desc: '',
       args: [],
     );
@@ -873,13 +820,12 @@ class S {
     );
   }
 
-  /// `By clicking log in, I agree to the`
-  String get byClickingLogInIAgreeToThe {
+  /// `By clicking log in, I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>`
+  String get loginTerms {
     return Intl.message(
-      'By clicking log in, I agree to the',
-      name: 'byClickingLogInIAgreeToThe',
-      desc:
-          'This text is part the sentence \'By clicking log in, I agree to the terms of service and privacy policy\'',
+      'By clicking log in, I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>',
+      name: 'loginTerms',
+      desc: '',
       args: [],
     );
   }

+ 3 - 20
lib/l10n/intl_en.arb

@@ -82,29 +82,12 @@
   "sorryWeCouldNotGenerateSecureKeysOnThisDevicennplease": "Sorry, we could not generate secure keys on this device.\n\nplease sign up from a different device.",
   "howItWorks": "How it works",
   "encryption": "Encryption",
-  "ackPasswordLostWarningPart1": "I understand that if I lose my password, I may lose my data since my data is ",
-  "endToEndEncrypted": "end-to-end encrypted",
-  "ackPasswordLostWarningPart2": " with ente",
-  "@ackPasswordLostWarningPart2": {
-    "description": "This text is part2 the sentence 'I understand that if I lose my password, I may lose my data since my data is end-to-end encrypted with ente.'"
-  },
+  "ackPasswordLostWarning": "I understand that if I lose my password, I may lose my data since my data is <underline>end-to-end encrypted</underline>.",
   "privacyPolicyTitle": "Privacy Policy",
   "termsOfServicesTitle": "Terms",
-  "termsAgreePart1": "I agree to the ",
-  "@termsAgreePart1": {
-    "description": "Note: there's a trailing space. This text is part the sentence 'I agree to the terms of service and privacy policy.'"
-  },
-  "privacyPolicy": "privacy policy",
-  "and": "and",
-  "@and": {
-    "description": "Separator used in sentences like 'I agree to the terms of service and privacy policy.'"
-  },
-  "termsOfService": "terms of service",
+  "signUpTerms" : "I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>",
   "logInLabel": "Log in",
-  "byClickingLogInIAgreeToThe": "By clicking log in, I agree to the",
-  "@byClickingLogInIAgreeToThe": {
-    "description": "This text is part the sentence 'By clicking log in, I agree to the terms of service and privacy policy'"
-  },
+  "loginTerms": "By clicking log in, I agree to the <u-terms>terms of service</u-terms> and <u-policy>privacy policy</u-policy>",
   "changeEmail": "Change email",
   "enterYourPassword": "Enter your password",
   "welcomeBack": "Welcome back!",

+ 61 - 85
lib/ui/account/email_entry_page.dart

@@ -1,5 +1,4 @@
 import 'package:email_validator/email_validator.dart';
-import 'package:flutter/gestures.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/services.dart';
 import 'package:password_strength/password_strength.dart';
@@ -10,6 +9,7 @@ import 'package:photos/services/user_service.dart';
 import 'package:photos/ui/common/dynamic_fab.dart';
 import 'package:photos/ui/common/web_page.dart';
 import 'package:step_progress_indicator/step_progress_indicator.dart';
+import "package:styled_text/styled_text.dart";
 
 class EmailEntryPage extends StatefulWidget {
   const EmailEntryPage({Key? key}) : super(key: key);
@@ -369,58 +369,46 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
             },
           ),
           Expanded(
-            child: RichText(
-              text: TextSpan(
-                children: [
-                  TextSpan(
-                    text: S.of(context).termsAgreePart1,
-                  ),
-                  TextSpan(
-                    text: S.of(context).termsOfService,
-                    style: const TextStyle(
-                      decoration: TextDecoration.underline,
-                    ),
-                    recognizer: TapGestureRecognizer()
-                      ..onTap = () {
-                        Navigator.of(context).push(
-                          MaterialPageRoute(
-                            builder: (BuildContext context) {
-                              return WebPage(
-                                S.of(context).termsOfServicesTitle,
-                                "https://ente.io/terms",
-                              );
-                            },
-                          ),
-                        );
-                      },
+            child: StyledText(
+              text: S.of(context).signUpTerms,
+              style:
+                  Theme.of(context).textTheme.subtitle1!.copyWith(fontSize: 12),
+              tags: {
+                'u-terms': StyledTextActionTag(
+                  (String? text, Map<String?, String?> attrs) => {
+                    Navigator.of(context).push(
+                      MaterialPageRoute(
+                        builder: (BuildContext context) {
+                          return WebPage(
+                            S.of(context).termsOfServicesTitle,
+                            "https://ente.io/terms",
+                          );
+                        },
+                      ),
+                    )
+                  },
+                  style: const TextStyle(
+                    decoration: TextDecoration.underline,
                   ),
-                  TextSpan(text: ' ${S.of(context).and} '),
-                  TextSpan(
-                    text: S.of(context).privacyPolicy,
-                    style: const TextStyle(
-                      decoration: TextDecoration.underline,
-                    ),
-                    recognizer: TapGestureRecognizer()
-                      ..onTap = () {
-                        Navigator.of(context).push(
-                          MaterialPageRoute(
-                            builder: (BuildContext context) {
-                              return WebPage(
-                                S.of(context).privacyPolicyTitle,
-                                "https://ente.io/privacy",
-                              );
-                            },
-                          ),
-                        );
-                      },
+                ),
+                'u-policy': StyledTextActionTag(
+                  (String? text, Map<String?, String?> attrs) => {
+                    Navigator.of(context).push(
+                      MaterialPageRoute(
+                        builder: (BuildContext context) {
+                          return WebPage(
+                            S.of(context).privacyPolicyTitle,
+                            "https://ente.io/privacy",
+                          );
+                        },
+                      ),
+                    )
+                  },
+                  style: const TextStyle(
+                    decoration: TextDecoration.underline,
                   ),
-                ],
-                style: Theme.of(context)
-                    .textTheme
-                    .subtitle1!
-                    .copyWith(fontSize: 12),
-              ),
-              textAlign: TextAlign.left,
+                )
+              },
             ),
           ),
         ],
@@ -448,41 +436,29 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
             },
           ),
           Expanded(
-            child: RichText(
-              text: TextSpan(
-                children: [
-                  TextSpan(
-                    text: S.of(context).ackPasswordLostWarningPart1,
-                  ),
-                  TextSpan(
-                    text: S.of(context).endToEndEncrypted,
-                    style: const TextStyle(
-                      decoration: TextDecoration.underline,
-                    ),
-                    recognizer: TapGestureRecognizer()
-                      ..onTap = () {
-                        Navigator.of(context).push(
-                          MaterialPageRoute(
-                            builder: (BuildContext context) {
-                              return WebPage(
-                                S.of(context).encryption,
-                                "https://ente.io/architecture",
-                              );
-                            },
-                          ),
-                        );
-                      },
-                  ),
-                  TextSpan(
-                    text: " ${S.of(context).ackPasswordLostWarningPart2}",
+            child: StyledText(
+              text: S.of(context).ackPasswordLostWarning,
+              style:
+                  Theme.of(context).textTheme.subtitle1!.copyWith(fontSize: 12),
+              tags: {
+                'underline': StyledTextActionTag(
+                  (String? text, Map<String?, String?> attrs) => {
+                    Navigator.of(context).push(
+                      MaterialPageRoute(
+                        builder: (BuildContext context) {
+                          return WebPage(
+                            S.of(context).encryption,
+                            "https://ente.io/architecture",
+                          );
+                        },
+                      ),
+                    )
+                  },
+                  style: const TextStyle(
+                    decoration: TextDecoration.underline,
                   ),
-                ],
-                style: Theme.of(context)
-                    .textTheme
-                    .subtitle1!
-                    .copyWith(fontSize: 12),
-              ),
-              textAlign: TextAlign.left,
+                ),
+              },
             ),
           ),
         ],

+ 42 - 53
lib/ui/account/login_page.dart

@@ -1,5 +1,4 @@
 import 'package:email_validator/email_validator.dart';
-import 'package:flutter/gestures.dart';
 import 'package:flutter/material.dart';
 import 'package:photos/core/configuration.dart';
 import "package:photos/generated/l10n.dart";
@@ -7,6 +6,7 @@ import "package:photos/l10n/l10n.dart";
 import 'package:photos/services/user_service.dart';
 import 'package:photos/ui/common/dynamic_fab.dart';
 import 'package:photos/ui/common/web_page.dart';
+import "package:styled_text/styled_text.dart";
 
 class LoginPage extends StatefulWidget {
   const LoginPage({Key? key}) : super(key: key);
@@ -142,63 +142,52 @@ class _LoginPageState extends State<LoginPage> {
                     children: [
                       Expanded(
                         flex: 5,
-                        child: RichText(
-                          text: TextSpan(
-                            style: Theme.of(context)
-                                .textTheme
-                                .subtitle1!
-                                .copyWith(fontSize: 12),
-                            children: [
-                              TextSpan(
-                                text: S.of(context).byClickingLogInIAgreeToThe +
-                                    " ",
+                        child: StyledText(
+                          text: S.of(context).loginTerms,
+                          style: Theme.of(context)
+                              .textTheme
+                              .subtitle1!
+                              .copyWith(fontSize: 12),
+                          tags: {
+                            'u-terms': StyledTextActionTag(
+                              (String? text, Map<String?, String?> attrs) => {
+                                Navigator.of(context).push(
+                                  MaterialPageRoute(
+                                    builder: (BuildContext context) {
+                                      return WebPage(
+                                        S.of(context).termsOfServicesTitle,
+                                        "https://ente.io/terms",
+                                      );
+                                    },
+                                  ),
+                                )
+                              },
+                              style: const TextStyle(
+                                decoration: TextDecoration.underline,
                               ),
-                              TextSpan(
-                                text: S.of(context).termsOfService,
-                                style: const TextStyle(
-                                  decoration: TextDecoration.underline,
-                                ),
-                                recognizer: TapGestureRecognizer()
-                                  ..onTap = () {
-                                    Navigator.of(context).push(
-                                      MaterialPageRoute(
-                                        builder: (BuildContext context) {
-                                          return WebPage(
-                                            S.of(context).termsOfServicesTitle,
-                                            "https://ente.io/terms",
-                                          );
-                                        },
-                                      ),
-                                    );
-                                  },
+                            ),
+                            'u-policy': StyledTextActionTag(
+                              (String? text, Map<String?, String?> attrs) => {
+                                Navigator.of(context).push(
+                                  MaterialPageRoute(
+                                    builder: (BuildContext context) {
+                                      return WebPage(
+                                        S.of(context).privacyPolicyTitle,
+                                        "https://ente.io/privacy",
+                                      );
+                                    },
+                                  ),
+                                )
+                              },
+                              style: const TextStyle(
+                                decoration: TextDecoration.underline,
                               ),
-                              TextSpan(text: " ${S.of(context).and} "),
-                              TextSpan(
-                                text: S.of(context).privacyPolicy,
-                                style: const TextStyle(
-                                  decoration: TextDecoration.underline,
-                                ),
-                                recognizer: TapGestureRecognizer()
-                                  ..onTap = () {
-                                    Navigator.of(context).push(
-                                      MaterialPageRoute(
-                                        builder: (BuildContext context) {
-                                          return WebPage(
-                                            S.of(context).privacyPolicyTitle,
-                                            "https://ente.io/privacy",
-                                          );
-                                        },
-                                      ),
-                                    );
-                                  },
-                              ),
-                            ],
-                          ),
-                          textAlign: TextAlign.left,
+                            )
+                          },
                         ),
                       ),
                       Expanded(
-                        flex: 2,
+                        flex: 1,
                         child: Container(),
                       )
                     ],