def pull_translations(): resources = ('website-strings', ) for resname in resources: transifexlib.process_resource( resname, DEFAULT_LANGS, '../_locales/en/messages.json', lambda lang: f'../_locales/{lang}/messages.json', None) # no mutator print(f'{resname}: DONE')
def pull_app_translations(): transifexlib.process_resource( 'windows-client-strings', DEFAULT_LANGS, '../src/webui/_locales/en/messages.json', lambda lang: f'../src/webui/_locales/{lang}/messages.json', None) # no mutator # We need to run grunt to incorporate the new translations print('Running grunt...') os.chdir('../src/webui') subprocess.run(['grunt'], shell=True, check=True)
def pull_app_translations(): transifexlib.process_resource( 'android-app-strings', APP_LANGS, '../app/src/main/res/values/strings.xml', lambda lang: f'../app/src/main/res/values-{lang}/strings.xml', None) # no mutator print(f'android-app-strings: DONE') transifexlib.process_resource( 'android-library-strings', APP_LANGS, '../app/src/main/res/values/psiphon_android_library_strings.xml', lambda lang: f'../app/src/main/res/values-{lang}/psiphon_android_library_strings.xml', None) # no mutator print(f'android-library-strings: DONE') transifexlib.process_resource( 'android-app-browser-strings', APP_LANGS, '../app/src/main/res/values/zirco_browser_strings.xml', lambda lang: f'../app/src/main/res/values-{lang}/zirco_browser_strings.xml', None) # no mutator print(f'android-app-browser-strings: DONE') transifexlib.process_resource( 'psiphon-pro-android-strings', APP_LANGS, '../app/src/main/res/values/pro-strings.xml', lambda lang: f'../app/src/main/res/values-{lang}/pro-strings.xml', None, # no mutator project='psiphon-pro') print(f'psiphon-pro-android-strings: DONE')
def pull_feedback_translations(): transifexlib.process_resource( 'feedback-template-strings', FEEDBACK_LANGS, f'{FEEDBACK_DIR}/en.yaml', lambda lang: f'{FEEDBACK_DIR}/temp/{lang}.yaml', None) # no mutator # Copy the English file into temp dir for processing shutil.copy2(f'{FEEDBACK_DIR}/en.yaml', f'{FEEDBACK_DIR}/temp/en.yaml') # Generate the HTML file make_feedback_html(f'{FEEDBACK_DIR}/feedback.html.tpl', f'{FEEDBACK_DIR}/temp', f'{FEEDBACK_DIR}/temp/feedback.html') # Copy the HTML file to where it needs to be shutil.copy2(f'{FEEDBACK_DIR}/temp/feedback.html', '../app/src/main/assets/feedback.html') shutil.rmtree(f'{FEEDBACK_DIR}/temp') print(f'feedback-template-strings: DONE')