Sfoglia il codice sorgente

delocalize check names

Armin Schrenk 3 anni fa
parent
commit
f907e2d033

+ 3 - 11
src/main/java/org/cryptomator/ui/health/Check.java

@@ -11,15 +11,12 @@ import javafx.beans.property.SimpleBooleanProperty;
 import javafx.beans.property.SimpleObjectProperty;
 import javafx.collections.FXCollections;
 import javafx.collections.ObservableList;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
 
 public class Check {
 
 	private static final String LOCALIZE_PREFIX = "health.";
 
 	private final HealthCheck check;
-	private final ResourceBundle resourceBundle;
 
 	private final BooleanProperty chosenForExecution = new SimpleBooleanProperty(false);
 	private final ObjectProperty<CheckState> state = new SimpleObjectProperty<>(CheckState.RUNNABLE);
@@ -28,17 +25,12 @@ public class Check {
 	private final ObjectProperty<Throwable> error = new SimpleObjectProperty<>(null);
 	private final BooleanBinding isInReRunState = state.isNotEqualTo(CheckState.RUNNING).or(state.isNotEqualTo(CheckState.SCHEDULED));
 
-	Check(HealthCheck check, ResourceBundle resourceBundle) {
+	Check(HealthCheck check) {
 		this.check = check;
-		this.resourceBundle = resourceBundle;
 	}
 
-	String getLocalizedName() {
-		try {
-			return resourceBundle.getString(LOCALIZE_PREFIX+check.name());
-		} catch (MissingResourceException e){
-			return check.name();
-		}
+	String getName() {
+		return check.name();
 	}
 
 	HealthCheck getHealthCheck() {

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

@@ -3,7 +3,6 @@ package org.cryptomator.ui.health;
 import com.tobiasdiez.easybind.EasyBind;
 import com.tobiasdiez.easybind.EasyObservableList;
 import com.tobiasdiez.easybind.Subscription;
-import com.tobiasdiez.easybind.optional.ObservableOptionalValue;
 import com.tobiasdiez.easybind.optional.OptionalBinding;
 import org.cryptomator.cryptofs.health.api.DiagnosticResult;
 import org.cryptomator.ui.common.FxController;
@@ -46,7 +45,7 @@ public class CheckDetailController implements FxController {
 		this.results = EasyBind.wrapList(FXCollections.observableArrayList());
 		this.check = selectedTask;
 		this.checkState = EasyBind.wrapNullable(selectedTask).mapObservable(Check::stateProperty);
-		this.checkName = EasyBind.wrapNullable(selectedTask).map(Check::getLocalizedName).orElse("");
+		this.checkName = EasyBind.wrapNullable(selectedTask).map(Check::getName).orElse("");
 		this.checkRunning = checkState.map(Check.CheckState.RUNNING::equals).orElse(false);
 		this.checkScheduled = checkState.map(Check.CheckState.SCHEDULED::equals).orElse(false);
 		this.checkSkipped = checkState.map(Check.CheckState.SKIPPED::equals).orElse(false);

+ 1 - 1
src/main/java/org/cryptomator/ui/health/CheckListCellController.java

@@ -27,7 +27,7 @@ public class CheckListCellController implements FxController {
 	public CheckListCellController() {
 		check = new SimpleObjectProperty<>();
 		checkRunnable = EasyBind.wrapNullable(check).mapObservable(Check::stateProperty).map(Check.CheckState.RUNNABLE::equals).orElse(false);
-		checkName = EasyBind.wrapNullable(check).map(Check::getLocalizedName).orElse("");
+		checkName = EasyBind.wrapNullable(check).map(Check::getName).orElse("");
 		subscriptions = new ArrayList<>();
 	}
 

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

@@ -67,8 +67,8 @@ abstract class HealthCheckModule {
 
 	@Provides
 	@HealthCheckScoped
-	static List<Check> provideAvailableChecks(ResourceBundle bundle) {
-		return HealthCheck.allChecks().stream().map(hc -> new Check(hc, bundle)).toList();
+	static List<Check> provideAvailableChecks() {
+		return HealthCheck.allChecks().stream().map(Check::new).toList();
 	}
 
 	@Provides

+ 0 - 2
src/main/resources/i18n/strings.properties

@@ -176,8 +176,6 @@ health.check.detail.checkFailed=The check exited due to an error.
 health.check.detail.checkCancelled=The check was cancelled.
 health.check.exportBtn=Export Report
 health.check.fixBtn=Fix
-## Checks
-health.org.cryptomator.cryptofs.health.dirid.DirIdCheck=Directory Check
 
 # Preferences
 preferences.title=Preferences