diff --git a/scripts/gen_i18n.py b/scripts/gen_i18n.py index 17f8e21c..bebfef9f 100755 --- a/scripts/gen_i18n.py +++ b/scripts/gen_i18n.py @@ -448,6 +448,7 @@ def generate_keys_header( "#include ", "", "// THIS FILE IS AUTO-GENERATED BY gen_i18n.py. DO NOT EDIT.", + "// clang-format off", "", "// Forward declarations for flat string data blobs and offset tables", "namespace i18n_strings {", @@ -529,9 +530,9 @@ def generate_keys_header( key=lambda i: languages[i], ) sorted_indices = [english_idx] + rest - comment_names = ", ".join(language_names[i] for i in sorted_indices) lines.append("// Sorted language indices by code (auto-generated by gen_i18n.py)") - lines.append(f"// Order: {comment_names}") + for rank, idx in enumerate(sorted_indices): + lines.append(f"// {rank:>2}: {languages[idx]:<4} {language_names[idx]}") lines.append( "constexpr uint8_t SORTED_LANGUAGE_INDICES[] = {" f"{', '.join(str(i) for i in sorted_indices)}" @@ -558,6 +559,7 @@ def generate_strings_header( '#include "I18nKeys.h"', "", "// THIS FILE IS AUTO-GENERATED BY gen_i18n.py. DO NOT EDIT.", + "// clang-format off", "", "namespace i18n_strings {", "", @@ -586,6 +588,7 @@ def generate_strings_cpp( "#include ", "", "// THIS FILE IS AUTO-GENERATED BY gen_i18n.py. DO NOT EDIT.", + "// clang-format off", "", ] @@ -626,13 +629,10 @@ def generate_strings_cpp( ) # Flat string data blob — all strings concatenated with \0 separators. - # clang-format off/on avoids reformatting of the adjacent string literals. - lines.append("// clang-format off") lines.append(f"const char STRINGS_{code}_DATA[] =") for text in lang_strings: _append_string_data_entry(lines, text) lines.append(";") - lines.append("// clang-format on") lines.append("") # Offset table — one uint16_t per StrId