Bläddra i källkod

hard coded UI strings replaced
showThirdText property binding

Jan-Peter Klein 1 månad sedan
förälder
incheckning
5110b35690

+ 22 - 25
src/main/java/org/cryptomator/ui/recoverykey/RecoveryKeyOnboardingController.java

@@ -31,13 +31,12 @@ public class RecoveryKeyOnboardingController implements FxController {
 	private final Stage window;
 	private final Lazy<Scene> recoverykeyRecoverScene;
 	private final Lazy<Scene> recoverykeyExpertSettingsScene;
-	private ObjectProperty<RecoveryActionType> recoverType;
+	private final ObjectProperty<RecoveryActionType> recoverType;
+	private final ResourceBundle resourceBundle;
 
 	public Label titleLabel;
 	public Label messageLabel;
 	public Label secondTextDesc;
-	public Label thirdTextIndex;
-	public Label thirdTextDesc;
 
 	@FXML
 	private CheckBox affirmationBox;
@@ -50,7 +49,7 @@ public class RecoveryKeyOnboardingController implements FxController {
 	@FXML
 	private VBox chooseMethodeBox;
 	private final ToggleGroup methodToggleGroup = new ToggleGroup();
-
+	private final BooleanProperty showThirdText = new SimpleBooleanProperty(true);
 
 	@Inject
 	public RecoveryKeyOnboardingController(@RecoveryKeyWindow Stage window, //
@@ -64,6 +63,7 @@ public class RecoveryKeyOnboardingController implements FxController {
 		this.recoverykeyRecoverScene = recoverykeyRecoverScene;
 		this.recoverykeyExpertSettingsScene = recoverykeyExpertSettingsScene;
 		this.recoverType = recoverType;
+		this.resourceBundle = resourceBundle;
 	}
 
 	@FXML
@@ -83,29 +83,17 @@ public class RecoveryKeyOnboardingController implements FxController {
 
 		switch (recoverType.get()) {
 			case RESTORE_VAULT_CONFIG -> {
-				window.setTitle("Recover Vault Config");
-				messageLabel.setText("Read this:");
-				secondTextDesc.setText("You will need the vault password or recovery key, a new password and possible some expert settings.");
-				thirdTextIndex.setVisible(false);
-				thirdTextIndex.setManaged(false);
-				thirdTextDesc.setVisible(false);
-				thirdTextDesc.setManaged(false);
+				window.setTitle(resourceBundle.getString("recoveryKey.recoverVaultConfig.title"));
+				messageLabel.setText(resourceBundle.getString("recoveryKey.recover.onBoarding.readThis"));
+				secondTextDesc.setText(resourceBundle.getString("recoveryKey.recover.onBoarding.recoverVaultConfig.intro2"));
+				showThirdText.set(false);
 			}
 			case RESTORE_MASTERKEY -> {
-				window.setTitle("Recover Masterkey");
-				messageLabel.setText("Read this:");
-				titleLabel.setText("Recover Masterkey");
-				secondTextDesc.setText("You will need the vault recovery key.");
-				thirdTextIndex.setVisible(false);
-				thirdTextIndex.setManaged(false);
-				thirdTextDesc.setVisible(false);
-				thirdTextDesc.setManaged(false);
-			}
-			default -> {
-				thirdTextIndex.setVisible(true);
-				thirdTextIndex.setManaged(true);
-				thirdTextDesc.setVisible(true);
-				thirdTextDesc.setManaged(true);
+				window.setTitle(resourceBundle.getString("recoveryKey.recoverMasterkey.title"));
+				messageLabel.setText(resourceBundle.getString("recoveryKey.recover.onBoarding.readThis"));
+				titleLabel.setText(resourceBundle.getString("recoveryKey.recoverMasterkey.title"));
+				secondTextDesc.setText(resourceBundle.getString("recoveryKey.recover.onBoarding.recoverMasterkey.intro2"));
+				showThirdText.set(false);
 			}
 		}
 	}
@@ -138,5 +126,14 @@ public class RecoveryKeyOnboardingController implements FxController {
 		}
 		window.centerOnScreen();
 	}
+
+	public BooleanProperty showThirdTextProperty() {
+		return showThirdText;
+	}
+
+	public boolean getShowThirdText() {
+		return showThirdText.get();
+	}
+
 }
 

+ 2 - 2
src/main/resources/fxml/recoverykey_onboarding.fxml

@@ -56,8 +56,8 @@
 						<Label text="%recoveryKey.recover.onBoarding.intro1" wrapText="true" GridPane.rowIndex="0" GridPane.columnIndex="1" />
 						<Label text="2." GridPane.rowIndex="1" GridPane.columnIndex="0" />
 						<Label fx:id="secondTextDesc" text="%recoveryKey.recover.onBoarding.intro2" wrapText="true" GridPane.rowIndex="1" GridPane.columnIndex="1" />
-						<Label fx:id="thirdTextIndex" text="3." GridPane.rowIndex="2" GridPane.columnIndex="0" />
-						<Label fx:id="thirdTextDesc" text="%recoveryKey.recover.onBoarding.intro3" wrapText="true" GridPane.rowIndex="2" GridPane.columnIndex="1" />
+						<Label text="3." GridPane.rowIndex="2" GridPane.columnIndex="0" visible="${controller.showThirdText}" managed="${controller.showThirdText}" />
+						<Label text="%recoveryKey.recover.onBoarding.intro3" wrapText="true" GridPane.rowIndex="2" GridPane.columnIndex="1" visible="${controller.showThirdText}" managed="${controller.showThirdText}" />
 					</GridPane>
 					<Region minHeight="15"/>
 					<VBox fx:id="chooseMethodeBox">

+ 6 - 1
src/main/resources/i18n/strings.properties

@@ -551,7 +551,12 @@ recoveryKey.noDDirDetected.message=Please choose a different folder that include
 recoveryKey.recoverVaultConfig.title=Recover Vault Config
 recoveryKey.recoverMasterkey.title=Recover Masterkey
 
-recoveryKey.recover.onBoarding.title=Restore your vault.cryptomator file
+
+recoveryKey.recover.onBoarding.recoverMasterkey.title=Restore your vault.cryptomator file
+recoveryKey.recover.onBoarding.recoverMasterkey.intro2=You will need the vault recovery key.
+recoveryKey.recover.onBoarding.recoverVaultConfig.intro2=You will need the vault password or recovery key, a new password and possible some expert settings.
+
+recoveryKey.recover.onBoarding.readThis=Read this:
 recoveryKey.recover.onBoarding.message=If your vault is a hub managed vault, the Hub Admin can restore the file for you. Otherwise:
 recoveryKey.recover.onBoarding.description=Otherwise you will need the Recovery Key of the vault, possible some expert settings, and a new vault password.
 recoveryKey.recover.onBoarding.confirm=Use RecoveryKey