Added a new test that ensures no two placeholders are the same

Fixed double 'param' parameter in existing translations
This commit is contained in:
Yair Morgenstern 2020-08-23 21:20:17 +03:00
parent 6185312fd9
commit 9ef7d8770d
8 changed files with 47 additions and 9 deletions

View file

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

View file

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

View file

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

View file

@ -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 = 钢铁厂

View file

@ -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 = 鋼鐵廠

View file

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

View file

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

View file

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