@@ -184,28 +184,32 @@ def apply_language(task):
184184 print (f'{ lang_code } : applied { total } translations to { len (by_xtb )} XTB files' )
185185
186186
187- def main ():
188- """CLI entrypoint"""
189- parser = argparse .ArgumentParser (description = 'Apply i18n translations to Chromium XTB files' )
190- parser .add_argument ('-t' ,
191- '--tree' ,
192- type = Path ,
193- required = True ,
194- help = 'Path to Chromium source tree' )
195- args = parser .parse_args ()
196-
187+ def apply_translations (tree ):
188+ """Applies all translations to all relevant .xtb files"""
197189 with open (SOURCE_PATH , encoding = 'utf-8' ) as file :
198190 source = json .load (file )
199191 with open (I18N_DIR / 'languages.json' , encoding = 'utf-8' ) as file :
200192 languages = json .load (file )
201193
202- namesub .add_grit_to_path (args . tree )
203- xtb_index = build_xtb_index (source , args . tree )
194+ namesub .add_grit_to_path (tree )
195+ xtb_index = build_xtb_index (source , tree )
204196
205197 tasks = [(code , source , xtb_index ) for code in languages ]
206198 with Pool () as pool :
207199 pool .map (apply_language , tasks )
208200
209201
202+ def main ():
203+ """CLI entrypoint"""
204+ parser = argparse .ArgumentParser (description = 'Apply i18n translations to Chromium XTB files' )
205+ parser .add_argument ('-t' ,
206+ '--tree' ,
207+ type = Path ,
208+ required = True ,
209+ help = 'Path to Chromium source tree' )
210+ args = parser .parse_args ()
211+ apply_translations (args .tree )
212+
213+
210214if __name__ == '__main__' :
211215 sys .exit (main ())
0 commit comments