From c130441700c9a42a1fd96e5b9ddc4eeeed2404b6 Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Sat, 2 Apr 2022 12:15:09 +0200 Subject: [PATCH] add setting for user-chosen "language" --- .../java/org/cryptomator/common/settings/Settings.java | 7 +++++++ .../cryptomator/common/settings/SettingsJsonAdapter.java | 2 ++ 2 files changed, 9 insertions(+) diff --git a/src/main/java/org/cryptomator/common/settings/Settings.java b/src/main/java/org/cryptomator/common/settings/Settings.java index 82f2fb794..8cc23bbfc 100644 --- a/src/main/java/org/cryptomator/common/settings/Settings.java +++ b/src/main/java/org/cryptomator/common/settings/Settings.java @@ -44,6 +44,7 @@ public class Settings { public static final String DEFAULT_LICENSE_KEY = ""; public static final boolean DEFAULT_SHOW_MINIMIZE_BUTTON = false; public static final String DEFAULT_DISPLAY_CONFIGURATION = ""; + public static final String DEFAULT_LANGUAGE = null; private final ObservableList directories = FXCollections.observableArrayList(VaultSettings::observables); @@ -66,6 +67,7 @@ public class Settings { private final IntegerProperty windowWidth = new SimpleIntegerProperty(); private final IntegerProperty windowHeight = new SimpleIntegerProperty(); private final ObjectProperty displayConfiguration = new SimpleObjectProperty<>(DEFAULT_DISPLAY_CONFIGURATION); + private final StringProperty language = new SimpleStringProperty(DEFAULT_LANGUAGE); private Consumer saveCmd; @@ -96,6 +98,7 @@ public class Settings { windowWidth.addListener(this::somethingChanged); windowHeight.addListener(this::somethingChanged); displayConfiguration.addListener(this::somethingChanged); + language.addListener(this::somethingChanged); } void setSaveCmd(Consumer saveCmd) { @@ -191,4 +194,8 @@ public class Settings { public ObjectProperty displayConfigurationProperty() { return displayConfiguration; } + + public StringProperty languageProperty() { + return language; + } } diff --git a/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java b/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java index 6d8d880e6..d10066f8f 100644 --- a/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java +++ b/src/main/java/org/cryptomator/common/settings/SettingsJsonAdapter.java @@ -57,6 +57,7 @@ public class SettingsJsonAdapter extends TypeAdapter { out.name("windowWidth").value((value.windowWidthProperty().get())); out.name("windowHeight").value((value.windowHeightProperty().get())); out.name("displayConfiguration").value((value.displayConfigurationProperty().get())); + out.name("language").value((value.languageProperty().get())); out.endObject(); } @@ -97,6 +98,7 @@ public class SettingsJsonAdapter extends TypeAdapter { case "windowWidth" -> settings.windowWidthProperty().set(in.nextInt()); case "windowHeight" -> settings.windowHeightProperty().set(in.nextInt()); case "displayConfiguration" -> settings.displayConfigurationProperty().set(in.nextString()); + case "language" -> settings.languageProperty().set(in.nextString()); default -> { LOG.warn("Unsupported vault setting found in JSON: " + name);