makerst: Skip generated header for translations

This reduces diff size on branch updates for godot-docs-l10n.

(cherry picked from commit eca3785100)
This commit is contained in:
Rémi Verschelde 2025-09-30 13:27:18 +02:00
parent cf6da2a12e
commit 6e33e3b7af
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -90,6 +90,7 @@ BASE_STRINGS = [
"[b]Note:[/b] The returned array is [i]copied[/i] and any changes to it will not update the original property value. See [%s] for more details.", "[b]Note:[/b] The returned array is [i]copied[/i] and any changes to it will not update the original property value. See [%s] for more details.",
] ]
strings_l10n: Dict[str, str] = {} strings_l10n: Dict[str, str] = {}
writing_translation = False
CLASS_GROUPS: Dict[str, str] = { CLASS_GROUPS: Dict[str, str] = {
"global": "Globals", "global": "Globals",
@ -704,6 +705,8 @@ def main() -> None:
# Retrieve heading translations for the given language. # Retrieve heading translations for the given language.
if not args.dry_run and args.lang != "en": if not args.dry_run and args.lang != "en":
global writing_translation
writing_translation = True
lang_file = os.path.join( lang_file = os.path.join(
os.path.dirname(os.path.realpath(__file__)), "..", "translations", "{}.po".format(args.lang) os.path.dirname(os.path.realpath(__file__)), "..", "translations", "{}.po".format(args.lang)
) )
@ -898,9 +901,9 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
if class_def.keywords is not None and class_def.keywords != "": if class_def.keywords is not None and class_def.keywords != "":
f.write(f".. meta::\n\t:keywords: {class_def.keywords}\n\n") f.write(f".. meta::\n\t:keywords: {class_def.keywords}\n\n")
if not writing_translation: # Skip for translations to reduce diff.
# Warn contributors not to edit this file directly. # Warn contributors not to edit this file directly.
# Also provide links to the source files for reference. # Also provide links to the source files for reference.
git_branch = get_git_branch() git_branch = get_git_branch()
source_xml_path = os.path.relpath(class_def.filepath, root_directory).replace("\\", "/") source_xml_path = os.path.relpath(class_def.filepath, root_directory).replace("\\", "/")
source_github_url = f"https://github.com/godotengine/godot/tree/{git_branch}/{source_xml_path}" source_github_url = f"https://github.com/godotengine/godot/tree/{git_branch}/{source_xml_path}"