Skip to content

Commit 6e33e3b

Browse files
committed
makerst: Skip generated header for translations
This reduces diff size on branch updates for godot-docs-l10n. (cherry picked from commit eca3785)
1 parent cf6da2a commit 6e33e3b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

doc/tools/make_rst.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
"[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.",
9191
]
9292
strings_l10n: Dict[str, str] = {}
93+
writing_translation = False
9394

9495
CLASS_GROUPS: Dict[str, str] = {
9596
"global": "Globals",
@@ -704,6 +705,8 @@ def main() -> None:
704705

705706
# Retrieve heading translations for the given language.
706707
if not args.dry_run and args.lang != "en":
708+
global writing_translation
709+
writing_translation = True
707710
lang_file = os.path.join(
708711
os.path.dirname(os.path.realpath(__file__)), "..", "translations", "{}.po".format(args.lang)
709712
)
@@ -898,18 +901,18 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir:
898901
if class_def.keywords is not None and class_def.keywords != "":
899902
f.write(f".. meta::\n\t:keywords: {class_def.keywords}\n\n")
900903

901-
# Warn contributors not to edit this file directly.
902-
# Also provide links to the source files for reference.
903-
904-
git_branch = get_git_branch()
905-
source_xml_path = os.path.relpath(class_def.filepath, root_directory).replace("\\", "/")
906-
source_github_url = f"https://github.com/godotengine/godot/tree/{git_branch}/{source_xml_path}"
907-
generator_github_url = f"https://github.com/godotengine/godot/tree/{git_branch}/doc/tools/make_rst.py"
908-
909-
f.write(".. DO NOT EDIT THIS FILE!!!\n")
910-
f.write(".. Generated automatically from Godot engine sources.\n")
911-
f.write(f".. Generator: {generator_github_url}.\n")
912-
f.write(f".. XML source: {source_github_url}.\n\n")
904+
if not writing_translation: # Skip for translations to reduce diff.
905+
# Warn contributors not to edit this file directly.
906+
# Also provide links to the source files for reference.
907+
git_branch = get_git_branch()
908+
source_xml_path = os.path.relpath(class_def.filepath, root_directory).replace("\\", "/")
909+
source_github_url = f"https://github.com/godotengine/godot/tree/{git_branch}/{source_xml_path}"
910+
generator_github_url = f"https://github.com/godotengine/godot/tree/{git_branch}/doc/tools/make_rst.py"
911+
912+
f.write(".. DO NOT EDIT THIS FILE!!!\n")
913+
f.write(".. Generated automatically from Godot engine sources.\n")
914+
f.write(f".. Generator: {generator_github_url}.\n")
915+
f.write(f".. XML source: {source_github_url}.\n\n")
913916

914917
# Document reference id and header.
915918
f.write(f".. _class_{sanitize_class_name(class_name)}:\n\n")

0 commit comments

Comments
 (0)