From 99ed87de173e95ed38902f6ed29b008df65f7a75 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 6 Mar 2020 18:28:56 +0100 Subject: [PATCH 1/2] updating vault file text and removing RTF format instructions from strings.properties --- .../ui/addvaultwizard/ReadmeGenerator.java | 27 ++++++++++++++----- .../main/resources/i18n/strings.properties | 16 +++++++---- .../addvaultwizard/ReadMeGeneratorTest.java | 6 ++--- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ReadmeGenerator.java b/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ReadmeGenerator.java index 19a5107e7..c1b7840ad 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ReadmeGenerator.java +++ b/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ReadmeGenerator.java @@ -10,21 +10,34 @@ public class ReadmeGenerator { // specs: https://web.archive.org/web/20190708132914/http://www.kleinlercher.at/tools/Windows_Protocols/Word2007RTFSpec9.pdf private static final String RTF_HEADER = "{\\rtf1\\fbidis\\ansi\\uc0\\fs32\n"; private static final String RTF_FOOTER = "}"; - private static final String HELP_URL = "{\\field{\\*\\fldinst HYPERLINK \"http://docs.cryptoamtor.org/\"}{\\fldrslt docs.cryptoamtor.org}}"; + private static final String HEADING = "\\fs40\\qc %s"; + private static final String EMPTY_PAR = ""; + private static final String DONT_PAR = "\\b %s"; + private static final String IDENT_PAR = " %s"; + private static final String HELP_URL = "{\\field{\\*\\fldinst HYPERLINK \"http://docs.cryptoamtor.org/\"}{\\fldrslt http://docs.cryptoamtor.org}}"; private final ResourceBundle resourceBundle; @Inject - public ReadmeGenerator(ResourceBundle resourceBundle){ + public ReadmeGenerator(ResourceBundle resourceBundle) { this.resourceBundle = resourceBundle; } public String createVaultStorageLocationReadmeRtf() { return createDocument(List.of( // - resourceBundle.getString("addvault.new.readme.storageLocation.1"), // + String.format(HEADING, resourceBundle.getString("addvault.new.readme.storageLocation.1")), // resourceBundle.getString("addvault.new.readme.storageLocation.2"), // - resourceBundle.getString("addvault.new.readme.storageLocation.3"), // - String.format(resourceBundle.getString("addvault.new.readme.storageLocation.4"), HELP_URL) // + EMPTY_PAR, // + String.format(DONT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.3")), // + String.format(IDENT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.4")), // + String.format(IDENT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.5")), // + EMPTY_PAR, // + resourceBundle.getString("addvault.new.readme.storageLocation.6"), // + String.format(IDENT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.7")), // + String.format(IDENT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.8")), // + String.format(IDENT_PAR, resourceBundle.getString("addvault.new.readme.storageLocation.9")), // + EMPTY_PAR, // + String.format(resourceBundle.getString("addvault.new.readme.storageLocation.10"), HELP_URL) // )); } @@ -40,9 +53,9 @@ public class ReadmeGenerator { String createDocument(Iterable paragraphs) { StringBuilder sb = new StringBuilder(RTF_HEADER); for (String p : paragraphs) { - sb.append("\\par {\\sa80 "); + sb.append("{\\sa80 "); appendEscaped(sb, p); - sb.append("}\n"); + sb.append("}\\par \n"); } sb.append(RTF_FOOTER); return sb.toString(); diff --git a/main/ui/src/main/resources/i18n/strings.properties b/main/ui/src/main/resources/i18n/strings.properties index 412b5afcb..645afdfa8 100644 --- a/main/ui/src/main/resources/i18n/strings.properties +++ b/main/ui/src/main/resources/i18n/strings.properties @@ -50,12 +50,18 @@ addvaultwizard.new.generateRecoveryKeyChoice=You won't be able to access your da addvaultwizard.new.generateRecoveryKeyChoice.yes=Yes please, better safe than sorry addvaultwizard.new.generateRecoveryKeyChoice.no=No thanks, I will not lose my password ### Information -addvault.new.readme.storageLocation.fileName=HELP.rtf -addvault.new.readme.storageLocation.1=\\fs40\\qc ⚠️ VAULT DIRECTORY ⚠️ -addvault.new.readme.storageLocation.2=This is your vault's storage location. {\\b DO NOT} alter any files within this directory. -addvault.new.readme.storageLocation.3=If you want to encrypt files using Cryptomator, unlock the vault and use the provided drive. -addvault.new.readme.storageLocation.4=If you need help, try %s. addvault.new.readme.accessLocation.fileName=WELCOME.rtf +addvault.new.readme.storageLocation.fileName=WHAT IS THIS DIRECTORY.rtf +addvault.new.readme.storageLocation.1=⚠️ VAULT FILES ⚠️ +addvault.new.readme.storageLocation.2=This is your vault's storage location. +addvault.new.readme.storageLocation.3=DO NOT +addvault.new.readme.storageLocation.4=• alter any files within this directory or +addvault.new.readme.storageLocation.5=• paste any files for encrypttion into this directory +addvault.new.readme.storageLocation.6=If you want to encrypt files and view the content of the vault, do the following: +addvault.new.readme.storageLocation.7=1. Add this vault to Cryptomator +addvault.new.readme.storageLocation.8=2. Unlock the vault in Cryptomator +addvault.new.readme.storageLocation.9=3. Open the access location by clicking the "Reveal" button +addvault.new.readme.storageLocation.10=If you need help, read the documentation: %s addvault.new.readme.accessLocation.1=\\fs40\\qc 🔐️ ENCRYPTED VOLUME 🔐️ addvault.new.readme.accessLocation.2=This is your vault's access location. Any files added to this volume will be encrypted by Cryptomator. To access this volume at a later point in time, simply unlock it again from within the Cryptomator application. addvault.new.readme.accessLocation.3=Feel free to remove this file. diff --git a/main/ui/src/test/java/org/cryptomator/ui/addvaultwizard/ReadMeGeneratorTest.java b/main/ui/src/test/java/org/cryptomator/ui/addvaultwizard/ReadMeGeneratorTest.java index 709fde0f0..9715c6654 100644 --- a/main/ui/src/test/java/org/cryptomator/ui/addvaultwizard/ReadMeGeneratorTest.java +++ b/main/ui/src/test/java/org/cryptomator/ui/addvaultwizard/ReadMeGeneratorTest.java @@ -37,9 +37,9 @@ public class ReadMeGeneratorTest { String result = readmeGenerator.createDocument(paragraphs); MatcherAssert.assertThat(result, CoreMatchers.startsWith("{\\rtf1\\fbidis\\ansi\\uc0\\fs32")); - MatcherAssert.assertThat(result, CoreMatchers.containsString("\\par {\\sa80 Dear User,}")); - MatcherAssert.assertThat(result, CoreMatchers.containsString("\\par {\\sa80 \\b please don't touch the \"d\" directory.}")); - MatcherAssert.assertThat(result, CoreMatchers.containsString("\\par {\\sa80 Thank you for your cooperation \\u55357\\u56841}")); + MatcherAssert.assertThat(result, CoreMatchers.containsString("{\\sa80 Dear User,}\\par")); + MatcherAssert.assertThat(result, CoreMatchers.containsString("{\\sa80 \\b please don't touch the \"d\" directory.}\\par ")); + MatcherAssert.assertThat(result, CoreMatchers.containsString("{\\sa80 Thank you for your cooperation \\u55357\\u56841}\\par")); MatcherAssert.assertThat(result, CoreMatchers.endsWith("}")); } From 70b70c55f3dad48239ab2ad0c063328b3a951332 Mon Sep 17 00:00:00 2001 From: Armin Schrenk Date: Fri, 6 Mar 2020 18:33:43 +0100 Subject: [PATCH 2/2] addtional removal of RTF sequences in strings.properties --- .../java/org/cryptomator/ui/addvaultwizard/ReadmeGenerator.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ReadmeGenerator.java b/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ReadmeGenerator.java index c1b7840ad..08a37a198 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ReadmeGenerator.java +++ b/main/ui/src/main/java/org/cryptomator/ui/addvaultwizard/ReadmeGenerator.java @@ -43,7 +43,7 @@ public class ReadmeGenerator { public String createVaultAccessLocationReadmeRtf() { return createDocument(List.of( // - resourceBundle.getString("addvault.new.readme.accessLocation.1"), // + String.format(HEADING,resourceBundle.getString("addvault.new.readme.accessLocation.1")), // resourceBundle.getString("addvault.new.readme.accessLocation.2"), // resourceBundle.getString("addvault.new.readme.accessLocation.3") // ));