Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marking strings as untranslatable #76198

Merged
merged 1 commit into from
Sep 25, 2024
Merged

Conversation

Uwuewsky
Copy link
Contributor

@Uwuewsky Uwuewsky commented Sep 4, 2024

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

@github-actions github-actions bot added <Documentation> Design documents, internal info, guides and help. Translation I18n [Markdown] Markdown issues and PRs [Python] Code made in Python astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions labels Sep 4, 2024
@Qrox
Copy link
Contributor

Qrox commented Sep 7, 2024

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.

@Maleclypse Maleclypse merged commit e1f0bff into CleverRaven:master Sep 25, 2024
19 of 23 checks passed
@Uwuewsky Uwuewsky deleted the no-i18n branch September 25, 2024 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Documentation> Design documents, internal info, guides and help. json-styled JSON lint passed, label assigned by github actions [Markdown] Markdown issues and PRs [Python] Code made in Python Translation I18n
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants