From 94a960abc2c56735e3b3c313badaad1ea39c18af Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 15 Dec 2019 22:00:12 +0200 Subject: [PATCH] All languages should work for everyone --- android/build.gradle | 4 ++-- core/src/com/unciv/models/ruleset/Ruleset.kt | 16 +++++++++++----- core/src/com/unciv/ui/CivilopediaScreen.kt | 2 +- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index d107484545..c41f314301 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.unciv.app" minSdkVersion 14 targetSdkVersion 29 - versionCode 342 - versionName "3.3.9" + versionCode 343 + versionName "3.3.9-patch1" archivesBaseName = "Unciv" } diff --git a/core/src/com/unciv/models/ruleset/Ruleset.kt b/core/src/com/unciv/models/ruleset/Ruleset.kt index bd1a3276ad..7c499457d1 100644 --- a/core/src/com/unciv/models/ruleset/Ruleset.kt +++ b/core/src/com/unciv/models/ruleset/Ruleset.kt @@ -116,9 +116,7 @@ class Ruleset { readTranslationsFromProperties() // readTranslationsFromJson() - val codeSourceFilePath = this.javaClass.protectionDomain.codeSource.location.path - if(Gdx.app.type==Application.ApplicationType.Desktop// we're running if from Android Studio or whatnot - && !codeSourceFilePath.endsWith(".jar")) + if(Gdx.app.type==Application.ApplicationType.Desktop) // Yes, also when running from the Jar. Sue me. writeNewTranslationFiles() val translationFilesTime = System.currentTimeMillis() - translationStart @@ -141,14 +139,22 @@ class Ruleset { private fun readTranslationsFromProperties() { val languages = ArrayList() - languages.addAll(Locale.getAvailableLocales() + // So apparently the Locales don't work for everyone, which is horrendous + // So for those players, which seem to be Android-y, we try to see what files exist directly...yeah =/ + try{ + for(file in Gdx.files.internal("jsons/translationsByLanguage").list()) + languages.add(file.nameWithoutExtension()) + } + catch (ex:Exception){} // Iterating on internal files will not work when running from a .jar + + languages.addAll(Locale.getAvailableLocales() // And this should work for Desktop, meaning from a .jar .map { it.displayName }) // These should probably ve renamed languages.add("Simplified_Chinese") languages.add("Traditional_Chinese") - for (language in languages) { + for (language in languages.distinct()) { val translationFileName = "jsons/translationsByLanguage/$language.properties" if (!Gdx.files.internal(translationFileName).exists()) continue val languageTranslations = TranslationFileReader().read(translationFileName) diff --git a/core/src/com/unciv/ui/CivilopediaScreen.kt b/core/src/com/unciv/ui/CivilopediaScreen.kt index 43c23416eb..ba4de29284 100644 --- a/core/src/com/unciv/ui/CivilopediaScreen.kt +++ b/core/src/com/unciv/ui/CivilopediaScreen.kt @@ -101,7 +101,7 @@ class CivilopediaScreen(ruleset: Ruleset) : CameraStageBaseScreen() { button.onClick { select(category) } buttonTable.add(button) } - select("Basics") + select("Tutorials") val sp = ScrollPane(entrySelectTable) sp.setupOverscroll(5f, 1f, 200f) entryTable.add(sp).width(Value.percentWidth(0.25f, entryTable)).height(Value.percentHeight(0.7f, entryTable))