|
90 | 90 | "[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.", |
91 | 91 | ] |
92 | 92 | strings_l10n: Dict[str, str] = {} |
| 93 | +writing_translation = False |
93 | 94 |
|
94 | 95 | CLASS_GROUPS: Dict[str, str] = { |
95 | 96 | "global": "Globals", |
@@ -704,6 +705,8 @@ def main() -> None: |
704 | 705 |
|
705 | 706 | # Retrieve heading translations for the given language. |
706 | 707 | if not args.dry_run and args.lang != "en": |
| 708 | + global writing_translation |
| 709 | + writing_translation = True |
707 | 710 | lang_file = os.path.join( |
708 | 711 | os.path.dirname(os.path.realpath(__file__)), "..", "translations", "{}.po".format(args.lang) |
709 | 712 | ) |
@@ -898,18 +901,18 @@ def make_rst_class(class_def: ClassDef, state: State, dry_run: bool, output_dir: |
898 | 901 | if class_def.keywords is not None and class_def.keywords != "": |
899 | 902 | f.write(f".. meta::\n\t:keywords: {class_def.keywords}\n\n") |
900 | 903 |
|
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") |
913 | 916 |
|
914 | 917 | # Document reference id and header. |
915 | 918 | f.write(f".. _class_{sanitize_class_name(class_name)}:\n\n") |
|
0 commit comments