diff --git a/main/commons/src/main/java/org/cryptomator/common/settings/UiTheme.java b/main/commons/src/main/java/org/cryptomator/common/settings/UiTheme.java index 70511554f..a8b66c65c 100644 --- a/main/commons/src/main/java/org/cryptomator/common/settings/UiTheme.java +++ b/main/commons/src/main/java/org/cryptomator/common/settings/UiTheme.java @@ -1,8 +1,8 @@ package org.cryptomator.common.settings; public enum UiTheme { - LIGHT("Light"), - DARK("Dark"); + LIGHT("preferences.general.theme.light"), + DARK("preferences.general.theme.dark"); // CUSTOM("Custom (%s)"); private String displayName; diff --git a/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java b/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java index 85c8630b0..1d4ec34ac 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/preferences/GeneralPreferencesController.java @@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory; import javax.inject.Inject; import javax.inject.Named; import java.util.Optional; +import java.util.ResourceBundle; import java.util.concurrent.ExecutorService; @PreferencesScoped @@ -35,6 +36,7 @@ public class GeneralPreferencesController implements FxController { private final ObjectProperty selectedTabProperty; private final LicenseHolder licenseHolder; private final ExecutorService executor; + private final ResourceBundle resourceBundle; public ChoiceBox themeChoiceBox; public CheckBox startHiddenCheckbox; public CheckBox debugModeCheckbox; @@ -44,20 +46,21 @@ public class GeneralPreferencesController implements FxController { public RadioButton nodeOrientationRtl; @Inject - GeneralPreferencesController(Settings settings, @Named("trayMenuSupported") boolean trayMenuSupported, Optional autoStartStrategy, ObjectProperty selectedTabProperty, LicenseHolder licenseHolder, ExecutorService executor) { + GeneralPreferencesController(Settings settings, @Named("trayMenuSupported") boolean trayMenuSupported, Optional autoStartStrategy, ObjectProperty selectedTabProperty, LicenseHolder licenseHolder, ExecutorService executor, ResourceBundle resourceBundle) { this.settings = settings; this.trayMenuSupported = trayMenuSupported; this.autoStartStrategy = autoStartStrategy; this.selectedTabProperty = selectedTabProperty; this.licenseHolder = licenseHolder; this.executor = executor; + this.resourceBundle = resourceBundle; } @FXML public void initialize() { themeChoiceBox.getItems().addAll(UiTheme.values()); themeChoiceBox.valueProperty().bindBidirectional(settings.theme()); - themeChoiceBox.setConverter(new UiThemeConverter()); + themeChoiceBox.setConverter(new UiThemeConverter(resourceBundle)); startHiddenCheckbox.selectedProperty().bindBidirectional(settings.startHidden()); @@ -116,9 +119,15 @@ public class GeneralPreferencesController implements FxController { private static class UiThemeConverter extends StringConverter { + private final ResourceBundle resourceBundle; + + UiThemeConverter(ResourceBundle resourceBundle) { + this.resourceBundle = resourceBundle; + } + @Override public String toString(UiTheme impl) { - return impl.getDisplayName(); + return resourceBundle.getString(impl.getDisplayName()); } @Override diff --git a/main/ui/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java b/main/ui/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java index 9ed5ba2ea..1556d0f74 100644 --- a/main/ui/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java +++ b/main/ui/src/main/java/org/cryptomator/ui/vaultoptions/MountOptionsController.java @@ -82,7 +82,7 @@ public class MountOptionsController implements FxController { // mount point options: mountPoint.selectedToggleProperty().addListener(this::toggleMountPoint); driveLetterSelection.getItems().addAll(windowsDriveLetters.getAllDriveLetters()); - driveLetterSelection.setConverter(new WinDriveLetterLabelConverter(windowsDriveLetters)); + driveLetterSelection.setConverter(new WinDriveLetterLabelConverter(windowsDriveLetters, resourceBundle)); driveLetterSelection.setValue(vault.getVaultSettings().winDriveLetter().get()); if (vault.getVaultSettings().usesIndividualMountPath().get()) { @@ -144,15 +144,17 @@ public class MountOptionsController implements FxController { private static class WinDriveLetterLabelConverter extends StringConverter { private final Set occupiedDriveLetters; + private final ResourceBundle resourceBundle; - WinDriveLetterLabelConverter(WindowsDriveLetters windowsDriveLetters) { + WinDriveLetterLabelConverter(WindowsDriveLetters windowsDriveLetters, ResourceBundle resourceBundle) { this.occupiedDriveLetters = windowsDriveLetters.getOccupiedDriveLetters(); + this.resourceBundle = resourceBundle; } @Override public String toString(String driveLetter) { if (occupiedDriveLetters.contains(driveLetter)) { - return driveLetter + ": (occupied)"; // TODO localize? + return driveLetter + ": (" + resourceBundle.getString("vaultOptions.mount.winDriveLetterOccupied") + ")"; } else { return driveLetter + ":"; } diff --git a/main/ui/src/main/resources/i18n/strings.properties b/main/ui/src/main/resources/i18n/strings.properties index 96ff90da6..10599e2a2 100644 --- a/main/ui/src/main/resources/i18n/strings.properties +++ b/main/ui/src/main/resources/i18n/strings.properties @@ -129,6 +129,8 @@ preferences.title=Preferences ## General preferences.general=General preferences.general.theme=Look & Feel +preferences.general.theme.light=Light +preferences.general.theme.dark=Dark preferences.general.unlockThemes=Unlock dark mode preferences.general.startHidden=Hide window when starting Cryptomator preferences.general.debugLogging=Enable debug logging