diff --git a/.tx/config b/.tx/config deleted file mode 100644 index 1db9c6557..000000000 --- a/.tx/config +++ /dev/null @@ -1,34 +0,0 @@ -; See https://docs.transifex.com/client/client-configuration - -[main] -host = https://www.transifex.com - -[o:musicbrainz:p:musicbrainz:r:picard] -file_filter = po/.po -source_file = po/picard.pot -source_lang = en -type = PO - -[o:musicbrainz:p:musicbrainz:r:picard_appstream] -file_filter = po/appstream/.po -source_file = po/appstream/picard-appstream.pot -source_lang = en -type = PO - -[o:musicbrainz:p:musicbrainz:r:picard_installer] -file_filter = installer/i18n/sources/.json -source_file = installer/i18n/sources/en.json -source_lang = en -type = KEYVALUEJSON - -[o:musicbrainz:p:musicbrainz:r:countries] -file_filter = po/countries/.po -source_file = po/countries/countries.pot -source_lang = en -type = PO - -[o:musicbrainz:p:musicbrainz:r:attributes] -file_filter = po/attributes/.po -source_file = po/attributes/attributes.pot -source_lang = en -type = PO diff --git a/setup.py b/setup.py index 745cf6d35..78be63b82 100644 --- a/setup.py +++ b/setup.py @@ -86,8 +86,6 @@ ext_modules = [ Extension('picard.util._astrcmp', sources=['picard/util/_astrcmp.c']), ] -tx_executable = which('tx') - def newer(source, target): """Return true if 'source' exists and is more recently modified than @@ -493,40 +491,6 @@ class picard_regen_appdata_pot_file(Command): ]) -class picard_pull_translations(Command): - description = "Retrieve po files from transifex" - minimum_perc_default = 5 - user_options = [ - ('minimum-perc=', 'm', - "Specify the minimum acceptable percentage of a translation (default: %d)" % minimum_perc_default) - ] - - def initialize_options(self): - self.minimum_perc = self.minimum_perc_default - - def finalize_options(self): - self.minimum_perc = int(self.minimum_perc) - - def run(self): - if tx_executable is None: - sys.exit('Transifex client executable (tx) not found.') - self.spawn([ - tx_executable, - 'pull', - '--force', - '--all', - '--minimum-perc=%d' % self.minimum_perc - ]) - self.spawn([ - tx_executable, - 'pull', - '--force', - '--languages', - 'en_AU,en_GB,en_CA' - 'musicbrainz.picard', - ]) - - _regen_pot_description = "Regenerate po/picard.pot, parsing source tree for new or updated strings" try: from babel import __version__ as babel_version @@ -581,32 +545,29 @@ def _get_option_name(obj): class picard_update_constants(Command): description = "Regenerate attributes.py and countries.py" user_options = [ - ('skip-pull', None, "skip the tx pull steps"), + ('skip-pull', None, "skip the translation pull step"), + ('weblate-key=', None, "Weblate API key"), ] boolean_options = ['skip-pull'] def initialize_options(self): self.skip_pull = None + self.weblate_key = None def finalize_options(self): self.locales = self.distribution.locales def run(self): - if tx_executable is None: - sys.exit('Transifex client executable (tx) not found.') - from babel.messages import pofile if not self.skip_pull: - txpull_cmd = [ - tx_executable, - 'pull', - '--force', - '--source', - 'musicbrainz.attributes', - 'musicbrainz.countries', + cmd = [ + os.path.join(os.path.dirname(__file__), 'scripts', 'tools', 'pull-shared-translations.py'), ] - self.spawn(txpull_cmd) + if self.weblate_key: + cmd.append('--key') + cmd.append(self.weblate_key) + self.spawn(cmd) countries = dict() countries_potfile = os.path.join('po', 'countries', 'countries.pot') @@ -794,7 +755,6 @@ args = { 'install': picard_install, 'install_locales': picard_install_locales, 'update_constants': picard_update_constants, - 'pull_translations': picard_pull_translations, 'regen_pot_file': picard_regen_pot_file, 'patch_version': picard_patch_version, },