fix: static member of Config declaring all languages supported by the application
This commit is contained in:
parent
dda01f3bfe
commit
827fe195a9
4 changed files with 6 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
package client.scenes;
|
package client.scenes;
|
||||||
|
|
||||||
|
import client.utils.Config;
|
||||||
import client.utils.LocaleAware;
|
import client.utils.LocaleAware;
|
||||||
import client.utils.LocaleManager;
|
import client.utils.LocaleManager;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
@ -46,7 +47,7 @@ public class LangSelectMenuCtrl implements LocaleAware {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeComponents() {
|
public void initializeComponents() {
|
||||||
langSelectMenu.getItems().setAll("en", "pl", "nl", "zht", "zhc", "tok", "tr");
|
langSelectMenu.getItems().setAll(Config.languages);
|
||||||
langSelectMenu.setValue(manager.getLocale().getLanguage());
|
langSelectMenu.setValue(manager.getLocale().getLanguage());
|
||||||
langSelectMenu.setConverter(new StringConverter<String>() {
|
langSelectMenu.setConverter(new StringConverter<String>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package client.scenes;
|
package client.scenes;
|
||||||
|
|
||||||
|
import client.utils.Config;
|
||||||
import client.utils.ConfigService;
|
import client.utils.ConfigService;
|
||||||
import client.utils.LocaleAware;
|
import client.utils.LocaleAware;
|
||||||
import client.utils.LocaleManager;
|
import client.utils.LocaleManager;
|
||||||
|
|
@ -54,7 +55,7 @@ public class LanguageFilterCtrl implements LocaleAware {
|
||||||
public void initializeComponents() {
|
public void initializeComponents() {
|
||||||
var items = this.langFilterMenu.getItems();
|
var items = this.langFilterMenu.getItems();
|
||||||
|
|
||||||
final List<String> languages = List.of("en", "nl", "pl", "tok", "tr");
|
final List<String> languages = List.of(Config.languages);
|
||||||
this.selectedLanguages = this.configService.getConfig().getRecipeLanguages();
|
this.selectedLanguages = this.configService.getConfig().getRecipeLanguages();
|
||||||
this.updateMenuButtonDisplay();
|
this.updateMenuButtonDisplay();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -422,7 +422,7 @@ public class RecipeDetailCtrl implements LocaleAware {
|
||||||
}
|
}
|
||||||
setCurrentlyViewedRecipe(recipe);
|
setCurrentlyViewedRecipe(recipe);
|
||||||
});
|
});
|
||||||
langSelector.getItems().addAll("en", "nl", "pl", "tok");
|
langSelector.getItems().addAll(Config.languages);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void handleAddAllToShoppingList(ActionEvent actionEvent) {
|
public void handleAddAllToShoppingList(ActionEvent actionEvent) {
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
||||||
|
|
||||||
public class Config {
|
public class Config {
|
||||||
private String language = "en";
|
private String language = "en";
|
||||||
|
public static String[] languages = {"en", "nl", "pl", "tok", "zhc", "zht"};
|
||||||
private List<String> recipeLanguages = new ArrayList<>();
|
private List<String> recipeLanguages = new ArrayList<>();
|
||||||
private String serverUrl = "http://localhost:8080";
|
private String serverUrl = "http://localhost:8080";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue