29
29
30
30
# Parse command-line arguments
31
31
parser = argparse .ArgumentParser (description = 'Convert a XLIFF translation files to JSON.' )
32
+ parser .add_argument ('--qa_build' , help = 'Set to true to output only English strings (only used for QA)' , action = argparse .BooleanOptionalAction )
32
33
parser .add_argument ('raw_translations_directory' , help = 'Directory which contains the raw translation files' )
33
34
parser .add_argument ('translations_output_directory' , help = 'Directory to save the converted translation files' )
34
35
parser .add_argument ('non_translatable_strings_output_path' , help = 'Path to save the non-translatable strings to' )
37
38
INPUT_DIRECTORY = args .raw_translations_directory
38
39
TRANSLATIONS_OUTPUT_DIRECTORY = args .translations_output_directory
39
40
NON_TRANSLATABLE_STRINGS_OUTPUT_PATH = args .non_translatable_strings_output_path
41
+ IS_QA_BUILD = args .qa_build
40
42
41
43
42
44
def parse_xliff (file_path ):
@@ -140,7 +142,7 @@ def convert_non_translatable_strings_to_type_script(input_file: str, output_path
140
142
file .write ('\n ' )
141
143
142
144
143
- def convert_all_files (input_directory : str ):
145
+ def convert_all_files (input_directory : str , is_qa_build : bool ):
144
146
setup_values = setup_generation (input_directory )
145
147
source_language , rtl_languages , non_translatable_strings_file , target_languages = setup_values .values ()
146
148
@@ -149,7 +151,7 @@ def convert_all_files(input_directory: str):
149
151
exported_locales = []
150
152
glossary_dict = load_glossary_dict (non_translatable_strings_file )
151
153
152
- for language in [source_language ] + target_languages :
154
+ for language in [source_language ] + [] if is_qa_build else target_languages :
153
155
lang_locale = language ['locale' ]
154
156
lang_two_letter_code = language ['twoLettersCode' ]
155
157
print (f"\033 [2K{ Fore .WHITE } ⏳ Converting translations for { lang_locale } to target format...{ Style .RESET_ALL } " , end = '\r ' )
@@ -166,7 +168,7 @@ def convert_all_files(input_directory: str):
166
168
167
169
if __name__ == "__main__" :
168
170
try :
169
- convert_all_files (INPUT_DIRECTORY )
171
+ convert_all_files (INPUT_DIRECTORY , IS_QA_BUILD )
170
172
except KeyboardInterrupt :
171
173
print ("\n Process interrupted by user" )
172
174
sys .exit (0 )
0 commit comments