From 308f20cb814ade432da09e72efc5679247af9158 Mon Sep 17 00:00:00 2001 From: Jeddunk Date: Fri, 28 Aug 2020 15:36:08 +0200 Subject: [PATCH] List of languages is now hardcoded! --- languages.txt | 16 ----------- src/main/java/Controller.java | 2 +- src/main/java/util/CreamApiConfig.java | 39 +++++++++++++++++++++----- 3 files changed, 33 insertions(+), 24 deletions(-) delete mode 100644 languages.txt diff --git a/languages.txt b/languages.txt deleted file mode 100644 index f1bee6a..0000000 --- a/languages.txt +++ /dev/null @@ -1,16 +0,0 @@ -# List of languages -# https://partner.steamgames.com/doc/store/localization#supported_languages - -english -latam -brazilian -german -french -italian -portuguese -spanish -russian -schinese -tchinese -japanese -koreana diff --git a/src/main/java/Controller.java b/src/main/java/Controller.java index 1f73fe4..6057d95 100644 --- a/src/main/java/Controller.java +++ b/src/main/java/Controller.java @@ -108,6 +108,7 @@ public class Controller { @FXML public void initialize() { appId_textfield.textProperty().addListener(appIdChangesGameName()); + language_combobox.setItems(FXCollections.observableArrayList(config.getLanguages())); //retrieveDlcList_button.setDisable(true); // WIP generate_tooltips(); fix_dlc_textarea_prompt_text(); @@ -115,7 +116,6 @@ public class Controller { } private void read() { - language_combobox.setItems(FXCollections.observableArrayList(config.getLanguages())); language_combobox.getSelectionModel().select(config.getLanguage()); appId_textfield.setText(config.getAppId().toString()); dlc_textarea.setText(config.getDlcListAsString()); diff --git a/src/main/java/util/CreamApiConfig.java b/src/main/java/util/CreamApiConfig.java index 45a9ef9..0e895db 100644 --- a/src/main/java/util/CreamApiConfig.java +++ b/src/main/java/util/CreamApiConfig.java @@ -52,13 +52,38 @@ public class CreamApiConfig { //e.printStackTrace(); } - File langFile = new File("languages.txt"); - try { - BufferedReader fIn = new BufferedReader(new FileReader(langFile)); - fIn.lines().filter(line -> !line.isEmpty() && !line.startsWith("#")).forEach(languages::add); - } catch (IOException e) { - e.printStackTrace(); - } + // https://partner.steamgames.com/doc/store/localization#supported_languages + languages.addAll(Arrays.asList( + "english", + "latam", + "brazilian", + "german", + "french", + "italian", + "portuguese", + "spanish", + "russian", + "schinese", + "tchinese", + "japanese", + "koreana", + "arabic", + "bulgarian", + "czech", + "danish", + "dutch", + "finnish", + "greek", + "hungarian", + "norwegian", + "polish", + "romanian", + "swedish", + "thai", + "turkish", + "ukrainian", + "vietnamese" + )); try { read();