All languages should work for everyone

This commit is contained in:
Yair Morgenstern
2019-12-15 22:00:12 +02:00
parent 873f578d9f
commit 94a960abc2
3 changed files with 14 additions and 8 deletions

View File

@ -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<String>()
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)

View File

@ -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))