def main(): dry_run = data['dry-run'] dtds = get_dtds(data['dtd'], data['mozilla-central']) print('======== DTDs ========') print(json.dumps(dtds, sort_keys=True, indent=2)) s = read_file(data['xul'], data['mozilla-central']) print('======== INPUT ========') print(s) print('======== OUTPUT ========') (new_xul, messages) = collect_messages(s, data['prefix']) print(new_xul) if not dry_run: write_file(data['xul'], new_xul, data['mozilla-central']) print('======== L10N ========') print(json.dumps(messages, sort_keys=True, indent=2)) migration = build_migration(messages, dtds, data) print('======== MIGRATION ========') print(migration) recipe_path = "{}/{}".format(data['migration'], data['recipe']) if not dry_run: write_file(recipe_path, migration, data['mozilla-central']) ftl = build_ftl(messages, dtds, data) print('======== Fluent ========') print(ftl.encode("utf-8")) if not dry_run: write_file(data['ftl'], ftl.encode("utf-8"), data['mozilla-central'], append=True)
'xul': 'browser/components/preferences/in-content/{0}.xul'.format(pane), 'dtd': [ 'browser/locales/en-US/chrome/browser/preferences/{0}.dtd'.format(pane) ], 'migration': './migration.py', 'ftl': 'browser/locales/en-US/browser/preferences/{0}.ftl'.format(pane), } if __name__ == '__main__': dtds = get_dtds(data['dtd'], data['mozilla-central']) s = read_file(data['xul'], data['mozilla-central']) print('======== INPUT ========') print(s) print('======== OUTPUT ========') (new_xul, messages) = collect_messages(s) print(new_xul) write_file(data['xul'], new_xul, data['mozilla-central']) print('======== L10N ========') print(json.dumps(messages, sort_keys=True, indent=2)) migration = build_migration(messages, dtds, data) print('======== MIGRATION ========') print(migration)