mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
All languages should work for everyone
This commit is contained in:
parent
873f578d9f
commit
94a960abc2
@ -21,8 +21,8 @@ android {
|
|||||||
applicationId "com.unciv.app"
|
applicationId "com.unciv.app"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 29
|
targetSdkVersion 29
|
||||||
versionCode 342
|
versionCode 343
|
||||||
versionName "3.3.9"
|
versionName "3.3.9-patch1"
|
||||||
|
|
||||||
archivesBaseName = "Unciv"
|
archivesBaseName = "Unciv"
|
||||||
}
|
}
|
||||||
|
@ -116,9 +116,7 @@ class Ruleset {
|
|||||||
|
|
||||||
readTranslationsFromProperties()
|
readTranslationsFromProperties()
|
||||||
// readTranslationsFromJson()
|
// readTranslationsFromJson()
|
||||||
val codeSourceFilePath = this.javaClass.protectionDomain.codeSource.location.path
|
if(Gdx.app.type==Application.ApplicationType.Desktop) // Yes, also when running from the Jar. Sue me.
|
||||||
if(Gdx.app.type==Application.ApplicationType.Desktop// we're running if from Android Studio or whatnot
|
|
||||||
&& !codeSourceFilePath.endsWith(".jar"))
|
|
||||||
writeNewTranslationFiles()
|
writeNewTranslationFiles()
|
||||||
|
|
||||||
val translationFilesTime = System.currentTimeMillis() - translationStart
|
val translationFilesTime = System.currentTimeMillis() - translationStart
|
||||||
@ -141,14 +139,22 @@ class Ruleset {
|
|||||||
private fun readTranslationsFromProperties() {
|
private fun readTranslationsFromProperties() {
|
||||||
|
|
||||||
val languages = ArrayList<String>()
|
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 })
|
.map { it.displayName })
|
||||||
|
|
||||||
// These should probably ve renamed
|
// These should probably ve renamed
|
||||||
languages.add("Simplified_Chinese")
|
languages.add("Simplified_Chinese")
|
||||||
languages.add("Traditional_Chinese")
|
languages.add("Traditional_Chinese")
|
||||||
|
|
||||||
for (language in languages) {
|
for (language in languages.distinct()) {
|
||||||
val translationFileName = "jsons/translationsByLanguage/$language.properties"
|
val translationFileName = "jsons/translationsByLanguage/$language.properties"
|
||||||
if (!Gdx.files.internal(translationFileName).exists()) continue
|
if (!Gdx.files.internal(translationFileName).exists()) continue
|
||||||
val languageTranslations = TranslationFileReader().read(translationFileName)
|
val languageTranslations = TranslationFileReader().read(translationFileName)
|
||||||
|
@ -101,7 +101,7 @@ class CivilopediaScreen(ruleset: Ruleset) : CameraStageBaseScreen() {
|
|||||||
button.onClick { select(category) }
|
button.onClick { select(category) }
|
||||||
buttonTable.add(button)
|
buttonTable.add(button)
|
||||||
}
|
}
|
||||||
select("Basics")
|
select("Tutorials")
|
||||||
val sp = ScrollPane(entrySelectTable)
|
val sp = ScrollPane(entrySelectTable)
|
||||||
sp.setupOverscroll(5f, 1f, 200f)
|
sp.setupOverscroll(5f, 1f, 200f)
|
||||||
entryTable.add(sp).width(Value.percentWidth(0.25f, entryTable)).height(Value.percentHeight(0.7f, entryTable))
|
entryTable.add(sp).width(Value.percentWidth(0.25f, entryTable)).height(Value.percentHeight(0.7f, entryTable))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user