瀏覽代碼

add translations for fixState filter

Armin Schrenk 2 年之前
父節點
當前提交
d932091021

+ 36 - 2
src/main/java/org/cryptomator/ui/health/CheckDetailController.java

@@ -123,6 +123,7 @@ public class CheckDetailController implements FxController {
 
 		fixStateChoiceBox.getItems().add(null);
 		fixStateChoiceBox.getItems().addAll(Arrays.stream(Result.FixState.values()).toList());
+		fixStateChoiceBox.setConverter(new FixStateStringifier());
 		fixStateChoiceBox.setValue(null);
 
 		resultsFilter.bind(Bindings.createObjectBinding(() -> this::filterResults, severityChoiceBox.valueProperty(), fixStateChoiceBox.valueProperty()));
@@ -158,7 +159,7 @@ public class CheckDetailController implements FxController {
 		@Override
 		public String toString(Severity object) {
 			if (object == null) {
-				return resourceBundle.getString("health.result.severityFilter.none");
+				return resourceBundle.getString("health.result.severityFilter.all");
 			}
 			return switch (object) {
 				case GOOD -> resourceBundle.getString("health.result.severityFilter.good");
@@ -184,6 +185,40 @@ public class CheckDetailController implements FxController {
 		}
 	}
 
+	class FixStateStringifier extends StringConverter<Result.FixState> {
+
+		@Override
+		public String toString(Result.FixState object) {
+			if (object == null) {
+				return resourceBundle.getString("health.result.fixStateFilter.all");
+			}
+			return switch (object) {
+				case FIXABLE -> resourceBundle.getString("health.result.fixStateFilter.fixable");
+				case NOT_FIXABLE -> resourceBundle.getString("health.result.fixStateFilter.notFixable");
+				case FIXING -> resourceBundle.getString("health.result.fixStateFilter.fixing");
+				case FIXED -> resourceBundle.getString("health.result.fixStateFilter.fixed");
+				case FIX_FAILED -> resourceBundle.getString("health.result.fixStateFilter.fixFailed");
+			};
+		}
+
+		@Override
+		public Result.FixState fromString(String string) {
+			if (resourceBundle.getString("health.result.fixStateFilter.fixable").equals(string)) {
+				return FIXABLE;
+			} else if (resourceBundle.getString("health.result.fixStateFilter.notFixable").equals(string)) {
+				return NOT_FIXABLE;
+			} else if (resourceBundle.getString("health.result.fixStateFilter.fixing").equals(string)) {
+				return FIXING;
+			} else if (resourceBundle.getString("health.result.fixStateFilter.fixed").equals(string)) {
+				return FIXED;
+			} else if (resourceBundle.getString("health.result.fixStateFilter.fixFailed").equals(string)) {
+				return FIX_FAILED;
+			} else {
+				return null;
+			}
+		}
+	}
+
 	/* Getter/Setter */
 
 	public String getCheckName() {
@@ -289,5 +324,4 @@ public class CheckDetailController implements FxController {
 	public boolean getFixAllInfoResultsPossible() {
 		return fixAllInfoResultsPossible.getValue();
 	}
-
 }

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

@@ -225,7 +225,7 @@ health.check.detail.listFilters.fixState=Fix state
 health.check.detail.fixAllSpecificBtn=Fix all of type
 health.check.exportBtn=Export Report
 ## Result view
-health.result.severityFilter.none=Severity - All
+health.result.severityFilter.all=Severity - All
 health.result.severityFilter.good=Good
 health.result.severityFilter.info=Info
 health.result.severityFilter.warn=Warning
@@ -234,6 +234,12 @@ health.result.severityTip.good=Severity: Good\nNormal vault structure.
 health.result.severityTip.info=Severity: Info\nVault structure intact, fix suggested.
 health.result.severityTip.warn=Severity: Warning\nVault structure corrupted, fix highly advised.
 health.result.severityTip.crit=Severity: Critical\nVault structure corrupted, data loss determined.
+health.result.fixStateFilter.all=Fix state - All
+health.result.fixStateFilter.fixable=Fixable
+health.result.fixStateFilter.notFixable=Not fixable
+health.result.fixStateFilter.fixing=Fixing…
+health.result.fixStateFilter.fixed=Fixed
+health.result.fixStateFilter.fixFailed=Fix failed
 ## Fix Application
 health.fix.fixBtn=Fix
 health.fix.successTip=Fix successful