Added localizable labels to recovery key display window

This commit is contained in:
Sebastian Stenzel
2019-10-09 15:15:13 +02:00
parent 7032862a65
commit c5a9926652
8 changed files with 34 additions and 10 deletions

View File

@@ -63,4 +63,9 @@ public class RecoveryKeyCreationController implements FxController {
window.close();
}
/* Getter/Setter */
public Vault getVault() {
return vault;
}
}

View File

@@ -4,6 +4,7 @@ import javafx.beans.property.ReadOnlyStringProperty;
import javafx.beans.property.StringProperty;
import javafx.fxml.FXML;
import javafx.stage.Stage;
import org.cryptomator.common.vaults.Vault;
import org.cryptomator.ui.common.FxController;
import javax.inject.Inject;
@@ -12,11 +13,13 @@ import javax.inject.Inject;
public class RecoveryKeyDisplayController implements FxController {
private final Stage window;
private final Vault vault;
private final StringProperty recoveryKeyProperty;
@Inject
public RecoveryKeyDisplayController(@RecoveryKeyWindow Stage window, @RecoveryKeyWindow StringProperty recoveryKey) {
public RecoveryKeyDisplayController(@RecoveryKeyWindow Stage window, @RecoveryKeyWindow Vault vault, @RecoveryKeyWindow StringProperty recoveryKey) {
this.window = window;
this.vault = vault;
this.recoveryKeyProperty = recoveryKey;
}
@@ -27,6 +30,10 @@ public class RecoveryKeyDisplayController implements FxController {
/* Getter/Setter */
public Vault getVault() {
return vault;
}
public ReadOnlyStringProperty recoveryKeyProperty() {
return recoveryKeyProperty;
}

View File

@@ -38,7 +38,7 @@ abstract class RecoveryKeyModule {
@RecoveryKeyScoped
static Stage provideStage(ResourceBundle resourceBundle, @Named("windowIcon") Optional<Image> windowIcon, @Named("keyRecoveryOwner") Stage owner) {
Stage stage = new Stage();
stage.setTitle("TODO keyRecovery.title"); // TODO localize
stage.setTitle(resourceBundle.getString("recoveryKey.title"));
stage.setResizable(false);
stage.initModality(Modality.WINDOW_MODAL);
stage.initOwner(owner);

View File

@@ -5,7 +5,7 @@
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.TextArea?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.VBox?>
<VBox xmlns="http://javafx.com/javafx"
@@ -23,8 +23,7 @@
<Label text="%addvaultwizard.new.recoveryKeyInstruction" wrapText="true"/>
<!-- TODO use TextArea instead -->
<TextField editable="false" text="${controller.recoveryKey}"/>
<TextArea editable="false" text="${controller.recoveryKey}" wrapText="true"/>
<CheckBox fx:id="finalConfirmationCheckbox" text="%addvaultwizard.new.recoveryKeySavedCheckbox" wrapText="true"/>

View File

@@ -5,6 +5,7 @@
<?import javafx.scene.control.ButtonBar?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import org.cryptomator.ui.controls.FormattedLabel?>
<?import org.cryptomator.ui.controls.NiceSecurePasswordField?>
<VBox xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
@@ -18,7 +19,10 @@
<Insets topRightBottomLeft="12"/>
</padding>
<children>
<NiceSecurePasswordField fx:id="passwordField" HBox.hgrow="ALWAYS"/>
<VBox spacing="6">
<FormattedLabel format="%recoveryKey.enterPassword.prompt" arg1="${controller.vault.displayableName}" wrapText="true"/>
<NiceSecurePasswordField fx:id="passwordField" HBox.hgrow="ALWAYS"/>
</VBox>
<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">
<ButtonBar buttonMinWidth="120" buttonOrder="C+X">

View File

@@ -9,6 +9,7 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.shape.Circle?>
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
<?import org.cryptomator.ui.controls.FormattedLabel?>
<VBox xmlns="http://javafx.com/javafx"
xmlns:fx="http://javafx.com/fxml"
fx:controller="org.cryptomator.ui.recoverykey.RecoveryKeyDisplayController"
@@ -27,9 +28,11 @@
<Circle styleClass="glyph-icon-primary" radius="24"/>
<FontAwesome5IconView styleClass="glyph-icon-white" glyph="CHECK" glyphSize="24"/>
</StackPane>
<!-- TODO use TextArea instead -->
<TextArea editable="false" text="${controller.recoveryKey}" wrapText="true" HBox.hgrow="ALWAYS"/>
<VBox spacing="6" HBox.hgrow="ALWAYS">
<FormattedLabel format="%recoveryKey.display.message" arg1="${controller.vault.displayableName}" wrapText="true" VBox.vgrow="NEVER"/>
<TextArea editable="false" text="${controller.recoveryKey}" wrapText="true" VBox.vgrow="ALWAYS"/>
</VBox>
</HBox>
<VBox alignment="BOTTOM_CENTER" VBox.vgrow="ALWAYS">

View File

@@ -12,6 +12,6 @@
</padding>
<children>
<Button text="%vaultOptions.general.changePasswordBtn" onAction="#changePassword"/>
<Button text="TODO show recovery key" onAction="#showRecoveryKey"/>
<Button text="%vaultOptions.general.showRecoveryKeyBtn" onAction="#showRecoveryKey"/>
</children>
</VBox>

View File

@@ -146,11 +146,17 @@ wrongFileAlert.information=You have tried to add a file or folder that does not
# Vault Options
vaultOptions.general=General
vaultOptions.general.changePasswordBtn=Change Password
vaultOptions.general.showRecoveryKeyBtn=Display Recovery Key
vaultOptions.mount=Mounting
vaultOptions.mount.readonly=Read-Only
vaultOptions.mount.driveName=Drive Name
vaultOptions.mount.customMountFlags=Custom Mount Flags
# Recovery Key
recoveryKey.title=Recovery Key
recoveryKey.enterPassword.prompt=Enter your password to show the recovery key for "%s":
recoveryKey.display.message=Recovery Key for "%s":
# Misc
passwordStrength.messageLabel.0=Very weak
passwordStrength.messageLabel.1=Weak