mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-24 03:53:12 -04:00
Minor TranslationFileWriter maintenance (#11858)
* Replace confusing `[Food] Focus` template with prettier `[stat] Focus` * Minor lint
This commit is contained in:
parent
4bb9d3bbc9
commit
3a16fcb021
@ -127,21 +127,16 @@ object TranslationFileWriter {
|
|||||||
linesToTranslate += "$uniqueTarget = "
|
linesToTranslate += "$uniqueTarget = "
|
||||||
|
|
||||||
linesToTranslate += "\n\n#################### Lines from spy actions #######################\n"
|
linesToTranslate += "\n\n#################### Lines from spy actions #######################\n"
|
||||||
for (spyAction in SpyAction.values()) {
|
for (spyAction in SpyAction.values())
|
||||||
linesToTranslate += "${spyAction.displayString} = "
|
linesToTranslate += "${spyAction.displayString} = "
|
||||||
}
|
|
||||||
|
|
||||||
linesToTranslate += "\n\n#################### Lines from diplomatic modifiers #######################\n"
|
linesToTranslate += "\n\n#################### Lines from diplomatic modifiers #######################\n"
|
||||||
for (diplomaticModifier in DiplomaticModifiers.values())
|
for (diplomaticModifier in DiplomaticModifiers.values())
|
||||||
linesToTranslate += "${diplomaticModifier.text} = "
|
linesToTranslate += "${diplomaticModifier.text} = "
|
||||||
|
|
||||||
linesToTranslate += "\n\n#################### Lines from key bindings #######################\n"
|
linesToTranslate += "\n\n#################### Lines from key bindings #######################\n"
|
||||||
for (category in KeyboardBinding.Category.values()) {
|
for (bindingLabel in KeyboardBinding.getTranslationEntries())
|
||||||
linesToTranslate += "${category.label} = "
|
linesToTranslate += "$bindingLabel = "
|
||||||
}
|
|
||||||
for (binding in KeyboardBinding.values()) {
|
|
||||||
linesToTranslate += "${binding.label} = "
|
|
||||||
}
|
|
||||||
|
|
||||||
for (baseRuleset in BaseRuleset.values()) {
|
for (baseRuleset in BaseRuleset.values()) {
|
||||||
val generatedStringsFromBaseRuleset =
|
val generatedStringsFromBaseRuleset =
|
||||||
|
@ -13,6 +13,8 @@ private fun unCamelCase(name: String) = unCamelCaseRegex.replace(name, """$1$4 $
|
|||||||
*
|
*
|
||||||
* Note a label is automatically generated from the name by inserting spaces before each uppercase letter (except the initial one),
|
* Note a label is automatically generated from the name by inserting spaces before each uppercase letter (except the initial one),
|
||||||
* and translation keys are automatically generated for all labels. This also works for [KeyboardBinding.Category].
|
* and translation keys are automatically generated for all labels. This also works for [KeyboardBinding.Category].
|
||||||
|
*
|
||||||
|
* [label] entries containing a placeholder need special treatment - see [getTranslationEntries] and update it when adding more.
|
||||||
*/
|
*/
|
||||||
enum class KeyboardBinding(
|
enum class KeyboardBinding(
|
||||||
val category: Category,
|
val category: Category,
|
||||||
@ -259,6 +261,14 @@ enum class KeyboardBinding(
|
|||||||
constructor(category: Category, key: Int) : this(category, KeyCharAndCode(key))
|
constructor(category: Category, key: Int) : this(category, KeyCharAndCode(key))
|
||||||
//endregion
|
//endregion
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
fun getTranslationEntries() = (
|
||||||
|
Category.values().asSequence().map { it.label }
|
||||||
|
+ values().asSequence().map { it.label }.filterNot { it.contains('[') }
|
||||||
|
+ sequenceOf("[stat] Focus")
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
/** Debug helper */
|
/** Debug helper */
|
||||||
override fun toString() = "$category.$name($defaultKey)"
|
override fun toString() = "$category.$name($defaultKey)"
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user