From 9ef7d8770dcbdef56f5bbb5bea9dbd398d766912 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Sun, 23 Aug 2020 21:20:17 +0300 Subject: [PATCH] Added a new test that ensures no two placeholders are the same Fixed double 'param' parameter in existing translations --- .../jsons/translations/German.properties | 2 +- .../jsons/translations/Indonesian.properties | 2 +- .../jsons/translations/Italian.properties | 2 +- .../Simplified_Chinese.properties | 2 +- .../Traditional_Chinese.properties | 2 +- buildSrc/src/main/kotlin/BuildConfig.kt | 4 ++-- changelog.md | 20 +++++++++++++++++ .../src/com/unciv/testing/TranslationTests.kt | 22 +++++++++++++++++-- 8 files changed, 47 insertions(+), 9 deletions(-) diff --git a/android/assets/jsons/translations/German.properties b/android/assets/jsons/translations/German.properties index 622e8c186f..2766de7faa 100644 --- a/android/assets/jsons/translations/German.properties +++ b/android/assets/jsons/translations/German.properties @@ -1092,7 +1092,7 @@ Angkor Wat = Angkor Wat 'Justice is an unassailable fortress, built on the brow of a mountain which cannot be overthrown by the violence of torrents, nor demolished by the force of armies.' - Joseph Addison = 'Die Gerechtigkeit ist eine unangreifbare Festung, die auf der Stirn eines Berges errichtet wurde, der nicht durch die Gewalt von Wildbächen gestürzt oder durch die Gewalt von Armeen zerstört werden kann.' - Joseph Addison # Requires translation! -All newly-trained [param] units in this city receive the [param] promotion = Alle neu trainierten [param] Einheiten dieser Stadt erhalten die [param] Beförderung +All newly-trained [param] units in this city receive the [param] promotion = Alle neu trainierten [param] Einheiten dieser Stadt erhalten die [promotion] Beförderung Alhambra = Alhambra Ironworks = Eisenhüttenwerk diff --git a/android/assets/jsons/translations/Indonesian.properties b/android/assets/jsons/translations/Indonesian.properties index 3e7f365a9c..bed63dc82b 100644 --- a/android/assets/jsons/translations/Indonesian.properties +++ b/android/assets/jsons/translations/Indonesian.properties @@ -1092,7 +1092,7 @@ Angkor Wat = Angkor Wat 'Justice is an unassailable fortress, built on the brow of a mountain which cannot be overthrown by the violence of torrents, nor demolished by the force of armies.' - Joseph Addison = 'Keadilan adalah benteng yang tidak dapat diserang, dibangun di atas alis gunung yang tidak dapat digulingkan oleh kekerasan yang terus-menerus, tidak dapat juga dihancurkan oleh kekuatan tentara' - Joseph Addison # Requires translation! -All newly-trained [param] units in this city receive the [param] promotion = Semua unit [param] yang baru dibuat di kota ini mendapatkan promosi [param] +All newly-trained [param] units in this city receive the [param] promotion = Semua unit [param] yang baru dibuat di kota ini mendapatkan promosi [promotion] Alhambra = Alhambra Ironworks = Pertukangan Besi diff --git a/android/assets/jsons/translations/Italian.properties b/android/assets/jsons/translations/Italian.properties index 4e87e95192..7f50df311a 100644 --- a/android/assets/jsons/translations/Italian.properties +++ b/android/assets/jsons/translations/Italian.properties @@ -1087,7 +1087,7 @@ Cost of acquiring new tiles reduced by 25% = -25% costo per l'acquisto di nuove Angkor Wat = Angkor Wat 'Justice is an unassailable fortress, built on the brow of a mountain which cannot be overthrown by the violence of torrents, nor demolished by the force of armies.' - Joseph Addison = 'La giustizia è una fortezza inespugnabile, costruita sulla cresta di una montagna che non può essere rovesciata dalla violenza dei torrenti né demolita dalla forza degli eserciti.' - Joseph Addison -All newly-trained [param] units in this city receive the [param] promotion = Tutte le nuove [param] nella città ricevono la promozione [param] +All newly-trained [param] units in this city receive the [param] promotion = Tutte le nuove [param] nella città ricevono la promozione [promotion] Alhambra = Alhambra Ironworks = Ferriera diff --git a/android/assets/jsons/translations/Simplified_Chinese.properties b/android/assets/jsons/translations/Simplified_Chinese.properties index f9833736d0..42c27fef97 100644 --- a/android/assets/jsons/translations/Simplified_Chinese.properties +++ b/android/assets/jsons/translations/Simplified_Chinese.properties @@ -1084,7 +1084,7 @@ Cost of acquiring new tiles reduced by 25% = 购买新地块花费-25% Angkor Wat = 吴哥窟 'Justice is an unassailable fortress, built on the brow of a mountain which cannot be overthrown by the violence of torrents, nor demolished by the force of armies.' - Joseph Addison = “正义是一座牢不可破的堡垒,屹立在山巅,既不为肆虐的洪流所冲倒,也不为军队的武力所毁坏。”——约瑟夫·艾迪生(英国散文家) -All newly-trained [param] units in this city receive the [param] promotion = 所在城市新组建的[param]单位获得“[param]”晋升 +All newly-trained [param] units in this city receive the [param] promotion = 所在城市新组建的[param]单位获得“[promotion]”晋升 Alhambra = 阿尔罕布拉宫 Ironworks = 钢铁厂 diff --git a/android/assets/jsons/translations/Traditional_Chinese.properties b/android/assets/jsons/translations/Traditional_Chinese.properties index f6392d5129..95a85174ba 100644 --- a/android/assets/jsons/translations/Traditional_Chinese.properties +++ b/android/assets/jsons/translations/Traditional_Chinese.properties @@ -1084,7 +1084,7 @@ Cost of acquiring new tiles reduced by 25% = 購買新地區花費-25% Angkor Wat = 吳哥窟 'Justice is an unassailable fortress, built on the brow of a mountain which cannot be overthrown by the violence of torrents, nor demolished by the force of armies.' - Joseph Addison = “正義是一座牢不可破的堡壘,屹立在山巔,既不為肆虐的洪流所沖倒,也不為軍隊的武力所毀壞。”——約瑟夫·艾迪生(英國散文家) -All newly-trained [param] units in this city receive the [param] promotion = 所在城市新組建的[param]單位獲得“[param]”晉升 +All newly-trained [param] units in this city receive the [param] promotion = 所在城市新組建的[param]單位獲得“[promotion]”晉升 Alhambra = 阿爾罕布拉宮 Ironworks = 鋼鐵廠 diff --git a/buildSrc/src/main/kotlin/BuildConfig.kt b/buildSrc/src/main/kotlin/BuildConfig.kt index c4c364ac25..e7ec874f42 100644 --- a/buildSrc/src/main/kotlin/BuildConfig.kt +++ b/buildSrc/src/main/kotlin/BuildConfig.kt @@ -3,8 +3,8 @@ package com.unciv.build object BuildConfig { const val kotlinVersion = "1.3.71" const val appName = "Unciv" - const val appCodeNumber = 463 - const val appVersion = "3.10.2" + const val appCodeNumber = 464 + const val appVersion = "3.10.3" const val gdxVersion = "1.9.10" const val roboVMVersion = "2.3.1" diff --git a/changelog.md b/changelog.md index 91786b5246..6bfb61e872 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,23 @@ +## 3.10.3 + +Settler 'by name' recognition changed to 'by unique' recognition, allowing for modded settler-like units + +Can now disable diplomatic relationship changes in a mod + +MapGen doesn't place ancient ruins if they're not defined in the current ruleset + +Resolved #3016 - Policy branch uniques are translated properly + +Borders consist of both civ colors, making some borders (esp. Germany) much clearer + +Roads and railoads can be removed outside your borders + +More generifications! + +Merged Building and Policy unique activations + +Translation updates + ## 3.10.2 Added link checks when loading mods, so you'll know if you messed something up when making them diff --git a/tests/src/com/unciv/testing/TranslationTests.kt b/tests/src/com/unciv/testing/TranslationTests.kt index d864381555..79e0958817 100644 --- a/tests/src/com/unciv/testing/TranslationTests.kt +++ b/tests/src/com/unciv/testing/TranslationTests.kt @@ -70,7 +70,6 @@ class TranslationTests { /** For every translatable string find its placeholders and check if all translations have them */ @Test - // TODO - This was broken and was then fixed, but it requires manual work fun allTranslationsHaveCorrectPlaceholders() { var allTranslationsHaveCorrectPlaceholders = true val languages = translations.getLanguages() @@ -97,7 +96,6 @@ class TranslationTests { @Test fun allPlaceholderKeysMatchEntry() { - val squareBraceRegex = Regex("""\[([^]]*)]""") var allPlaceholderKeysMatchEntry = true for (key in translations.keys) { if ( !key.contains('[') ) continue @@ -115,6 +113,26 @@ class TranslationTests { ) } + @Test + fun noTwoPlaceholdersAreTheSame() { + var noTwoPlaceholdersAreTheSame = true + for (translationEntry in translations.values) { + val placeholders = squareBraceRegex.findAll(translationEntry.entry) + .map { it.value }.toList() + + for (placeholder in placeholders) + if (placeholders.count { it == placeholder } > 1) { + noTwoPlaceholdersAreTheSame = false + println("Entry $translationEntry has the parameter $placeholder more than once") + break + } + } + Assert.assertTrue( + "This test will only pass when no translation keys have the same parameter twice", + noTwoPlaceholdersAreTheSame + ) + } + @Test fun allTranslationsEndWithASpace() { val templateLines = Gdx.files.internal(TranslationFileWriter.templateFileLocation).reader().readLines()