Made the program actually use the bundles
This commit is contained in:
parent
d13d9e28d0
commit
208a929708
2 changed files with 6 additions and 1 deletions
|
|
@ -18,6 +18,8 @@ package client;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
|
|
||||||
|
|
@ -28,6 +30,7 @@ import javafx.util.BuilderFactory;
|
||||||
import javafx.util.Callback;
|
import javafx.util.Callback;
|
||||||
import javafx.util.Pair;
|
import javafx.util.Pair;
|
||||||
|
|
||||||
|
|
||||||
public class MyFXML {
|
public class MyFXML {
|
||||||
|
|
||||||
private Injector injector;
|
private Injector injector;
|
||||||
|
|
@ -38,7 +41,8 @@ public class MyFXML {
|
||||||
|
|
||||||
public <T> Pair<T, Parent> load(Class<T> c, String... parts) {
|
public <T> Pair<T, Parent> load(Class<T> c, String... parts) {
|
||||||
try {
|
try {
|
||||||
var loader = new FXMLLoader(getLocation(parts), null, null, new MyFactory(), StandardCharsets.UTF_8);
|
ResourceBundle bundle = ResourceBundle.getBundle("locale.lang", Locale.getDefault());
|
||||||
|
var loader = new FXMLLoader(getLocation(parts), bundle, null, new MyFactory(), StandardCharsets.UTF_8);
|
||||||
Parent parent = loader.load();
|
Parent parent = loader.load();
|
||||||
T ctrl = loader.getController();
|
T ctrl = loader.getController();
|
||||||
return new Pair<>(ctrl, parent);
|
return new Pair<>(ctrl, parent);
|
||||||
|
|
|
||||||
|
|
@ -256,6 +256,7 @@ public class FoodpalApplicationCtrl implements LocaleAware {
|
||||||
removeRecipeButton.setText(getLocaleString("menu.button.remove.recipe"));
|
removeRecipeButton.setText(getLocaleString("menu.button.remove.recipe"));
|
||||||
cloneRecipeButton.setText(getLocaleString("menu.button.clone"));
|
cloneRecipeButton.setText(getLocaleString("menu.button.clone"));
|
||||||
recipesLabel.setText(getLocaleString("menu.label.recipes"));
|
recipesLabel.setText(getLocaleString("menu.label.recipes"));
|
||||||
|
favouritesOnlyToggle.setText(getLocaleString("menu.button.favourite"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue