Cataclysm-DDA icon indicating copy to clipboard operation
Cataclysm-DDA copied to clipboard

Marking strings as untranslatable

Open Uwuewsky opened this issue 1 year ago • 1 comments

Summary

I18N "Omit unnecessary lines from translations"

Purpose of change

Translation files contain many strings that are usually not visible to the player and do not make sense to translate.

#. ~ Spell name
#: data/mods/MindOverMatter/monsters/monsters_spells.json
msgid "[Ψ]Network Effect Monster"

#. ~ Description of spell "[Ψ]Network Effect Monster"
#: data/mods/MindOverMatter/monsters/monsters_spells.json
msgid "AI trigger for only casting when hostiles are present."

Describe the solution

Make it possible to specify a "flag" for the string extractor in the comment for translators:

"name": {
    "str": "[Ψ]Nether Banish Monster",
    "//~": "NO_I18N"
},
"description": {
    "str": "A spell for the zombie null to try to banish nether monsters.  It's a bug if you have it.",
    "//~": "NO_I18N"
},

The extractor will skip such marked strings.

Describe alternatives you've considered

This //~ comment for the translators must be inside a text object and be a string. But overall, it is a universal and simple solution, I don't think doing it any other way would be worth it.

Testing

For now (not in this PR) I've added these flags to vanilla game spells and monster's pseudo guns. 96967 vs 96680 = -287 strings in .pot file. There should be more after the mods. Diff file between these two translation files: pot.txt.

Additional context

Uwuewsky avatar Sep 04 '24 15:09 Uwuewsky

It might also make sense to toggle the no-translation flag inside the translation class so that the strings are not passed to translation functions.

Qrox avatar Sep 07 '24 02:09 Qrox