-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow runtime language switching
- Loading branch information
Showing
18 changed files
with
377 additions
and
123 deletions.
There are no files selected for viewing
247 changes: 221 additions & 26 deletions
247
src/main/java/com/codedead/opal/controller/MainWindowController.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
src/main/java/com/codedead/opal/domain/ObservableResourceFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.codedead.opal.domain; | ||
|
||
import javafx.beans.binding.StringBinding; | ||
import javafx.beans.property.ObjectProperty; | ||
import javafx.beans.property.SimpleObjectProperty; | ||
|
||
import java.util.ResourceBundle; | ||
|
||
public final class ObservableResourceFactory { | ||
|
||
private final ObjectProperty<ResourceBundle> resources; | ||
|
||
/** | ||
* Initialize a new ObservableResourceFactory | ||
*/ | ||
public ObservableResourceFactory() { | ||
resources = new SimpleObjectProperty<>(); | ||
} | ||
|
||
/** | ||
* Get the resources property | ||
* | ||
* @return The resources property | ||
*/ | ||
public ObjectProperty<ResourceBundle> resourcesProperty() { | ||
return resources; | ||
} | ||
|
||
/** | ||
* Get the resources | ||
* | ||
* @return The resources | ||
*/ | ||
public ResourceBundle getResources() { | ||
return resourcesProperty().get(); | ||
} | ||
|
||
/** | ||
* Set the resources | ||
* | ||
* @param resources The resources | ||
*/ | ||
public void setResources(final ResourceBundle resources) { | ||
resourcesProperty().set(resources); | ||
} | ||
|
||
/** | ||
* Get a string binding for the given key | ||
* | ||
* @param key The key | ||
* @return The {@link StringBinding} for the given key | ||
*/ | ||
public StringBinding getStringBinding(final String key) { | ||
return new StringBinding() { | ||
{ | ||
bind(resourcesProperty()); | ||
} | ||
|
||
@Override | ||
public String computeValue() { | ||
return getResources().getString(key); | ||
} | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.