mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-21 21:30:20 +07:00
Minor TranslationFileWriter maintenance (#11858)
* Replace confusing `[Food] Focus` template with prettier `[stat] Focus` * Minor lint
This commit is contained in:
@ -127,21 +127,16 @@ object TranslationFileWriter {
|
||||
linesToTranslate += "$uniqueTarget = "
|
||||
|
||||
linesToTranslate += "\n\n#################### Lines from spy actions #######################\n"
|
||||
for (spyAction in SpyAction.values()) {
|
||||
for (spyAction in SpyAction.values())
|
||||
linesToTranslate += "${spyAction.displayString} = "
|
||||
}
|
||||
|
||||
linesToTranslate += "\n\n#################### Lines from diplomatic modifiers #######################\n"
|
||||
for (diplomaticModifier in DiplomaticModifiers.values())
|
||||
linesToTranslate += "${diplomaticModifier.text} = "
|
||||
|
||||
linesToTranslate += "\n\n#################### Lines from key bindings #######################\n"
|
||||
for (category in KeyboardBinding.Category.values()) {
|
||||
linesToTranslate += "${category.label} = "
|
||||
}
|
||||
for (binding in KeyboardBinding.values()) {
|
||||
linesToTranslate += "${binding.label} = "
|
||||
}
|
||||
for (bindingLabel in KeyboardBinding.getTranslationEntries())
|
||||
linesToTranslate += "$bindingLabel = "
|
||||
|
||||
for (baseRuleset in BaseRuleset.values()) {
|
||||
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),
|
||||
* 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(
|
||||
val category: Category,
|
||||
@ -259,6 +261,14 @@ enum class KeyboardBinding(
|
||||
constructor(category: Category, key: Int) : this(category, KeyCharAndCode(key))
|
||||
//endregion
|
||||
|
||||
companion object {
|
||||
fun getTranslationEntries() = (
|
||||
Category.values().asSequence().map { it.label }
|
||||
+ values().asSequence().map { it.label }.filterNot { it.contains('[') }
|
||||
+ sequenceOf("[stat] Focus")
|
||||
)
|
||||
}
|
||||
|
||||
/** Debug helper */
|
||||
override fun toString() = "$category.$name($defaultKey)"
|
||||
}
|
||||
|
Reference in New Issue
Block a user