A platform for community discussion. Free, open, simple.
DEV: Switch from Transifex to Crowdin
Discourse Translator Bot29788f2c26bb
diff --git a/.tx/config b/.tx/configdeleted file mode 100644index 91635373848..00000000000--- a/.tx/config+++ /dev/null@@ -1,99 +0,0 @@-[main]-host = https://www.transifex.com-lang_map = el_GR: el, es_ES: es, fr_FR: fr, hu_HU: hu, ko_KR: ko, pt_PT: pt, sk_SK: sk, vi_VN: vi--[discourse-org.core-client-yml]-file_filter = config/locales/client.<lang>.yml-source_file = config/locales/client.en.yml-source_lang = en-type = YML--[discourse-org.core-server-yml]-file_filter = config/locales/server.<lang>.yml-source_file = config/locales/server.en.yml-source_lang = en-type = YML--[discourse-org.pollclientenyml]-file_filter = plugins/poll/config/locales/client.<lang>.yml-source_file = plugins/poll/config/locales/client.en.yml-source_lang = en-type = YML--[discourse-org.pollserverenyml]-file_filter = plugins/poll/config/locales/server.<lang>.yml-source_file = plugins/poll/config/locales/server.en.yml-source_lang = en-type = YML--[discourse-org.narrativeclientenyml]-file_filter = plugins/discourse-narrative-bot/config/locales/client.<lang>.yml-source_file = plugins/discourse-narrative-bot/config/locales/client.en.yml-source_lang = en-type = YML--[discourse-org.narrativeserverenyml]-file_filter = plugins/discourse-narrative-bot/config/locales/server.<lang>.yml-source_file = plugins/discourse-narrative-bot/config/locales/server.en.yml-source_lang = en-type = YML--[discourse-org.discourse-presenceclientenyml]-file_filter = plugins/discourse-presence/config/locales/client.<lang>.yml-source_file = plugins/discourse-presence/config/locales/client.en.yml-source_lang = en-type = YML--[discourse-org.discourse-presenceserverenyml]-file_filter = plugins/discourse-presence/config/locales/server.<lang>.yml-source_file = plugins/discourse-presence/config/locales/server.en.yml-source_lang = en-type = YML--[discourse-org.coreplugindetailsclientyml]-file_filter = plugins/discourse-details/config/locales/client.<lang>.yml-source_file = plugins/discourse-details/config/locales/client.en.yml-source_lang = en-type = YML--[discourse-org.coreplugindetailsserveryml]-file_filter = plugins/discourse-details/config/locales/server.<lang>.yml-source_file = plugins/discourse-details/config/locales/server.en.yml-source_lang = en-type = YML--[discourse-org.core-plugin-local-dates-client-yml]-file_filter = plugins/discourse-local-dates/config/locales/client.<lang>.yml-source_file = plugins/discourse-local-dates/config/locales/client.en.yml-source_lang = en-type = YML--[discourse-org.core-plugin-local-dates-server-yml]-file_filter = plugins/discourse-local-dates/config/locales/server.<lang>.yml-source_file = plugins/discourse-local-dates/config/locales/server.en.yml-source_lang = en-type = YML--[discourse-org.403html]-file_filter = public/403.<lang>.html-source_file = public/403.html-source_lang = en-type = HTML--[discourse-org.422html]-file_filter = public/422.<lang>.html-source_file = public/422.html-source_lang = en-type = HTML--[discourse-org.500html]-file_filter = public/500.<lang>.html-source_file = public/500.html-source_lang = en-type = HTML--[discourse-org.503html]-file_filter = public/503.<lang>.html-source_file = public/503.html-source_lang = en-type = HTMLdiff --git a/crowdin.yml b/crowdin.ymldeleted file mode 100644index 49c948f512b..00000000000--- a/crowdin.yml+++ /dev/null@@ -1,7 +0,0 @@-files:- - source: /**/config/locales/server.en.yml- translation: /%original_path%/server.%locale_with_underscore%.yml- - source: /**/config/locales/client.en.yml- translation: /%original_path%/client.%locale_with_underscore%.yml- - source: '/public/*[0-9].html'- translation: /%original_path%/%file_name%.%locale_with_underscore%.%file_extension%diff --git a/script/plugin-translations.rb b/script/plugin-translations.rbdeleted file mode 100644index 87bf4e8db8e..00000000000--- a/script/plugin-translations.rb+++ /dev/null@@ -1,91 +0,0 @@-# frozen_string_literal: true--if ARGV.empty?- puts 'Usage: ', ''- puts ' ruby plugin-translations.rb <plugins_base_dir>'- puts ' ruby plugin-translations.rb <plugins_base_dir> push (to git push)'- exit 1-end--require 'bundler'--class PluginTxUpdater-- attr_reader :failed-- PLUGINS = [- 'discourse-adplugin',- 'discourse-akismet',- 'discourse-assign',- 'discourse-cakeday',- 'discourse-canned-replies',- 'discourse-characters-required',- 'discourse-chat-integration',- 'discourse-checklist',- 'discourse-data-explorer',- 'discourse-math',- 'discourse-oauth2-basic',- 'discourse-patreon',- 'discourse-saved-searches',- 'discourse-solved',- 'discourse-user-notes',- 'discourse-voting'- ]-- def initialize(base_dir, push)- @push = !!push- @base_dir = base_dir- @failed = []- end-- def perform- PLUGINS.each do |plugin_name|- plugin_dir = File.join(@base_dir, plugin_name)- Bundler.with_clean_env do- Dir.chdir(plugin_dir) do # rubocop:disable Discourse/NoChdir because this is not part of the app- puts '', plugin_dir, '-' * 80, ''-- begin- system_cmd('git pull')- system_cmd('bundle update translations-manager')- system_cmd('bundle exec bin/pull_translations.rb')- system_cmd('git add config/locales/*')- system_cmd('git add Gemfile.lock') rescue true # might be gitignored- system_cmd('git add .tx/config') rescue true- system_cmd('git commit -m "Update translations"')- system_cmd('git push origin master') if @push- rescue => e- puts "Failed for #{plugin_name}. Skipping...", ''- @failed << plugin_name- end- end- end- end- end-- def system_cmd(s)- rc = system(s)- raise RuntimeError.new($?) if rc != true- end-end--base_dir = File.expand_path(ARGV[0])--unless File.exists?(base_dir)- puts '', "Dir '#{base_dir}' doesn't exist."- exit 1-end--updates = PluginTxUpdater.new(base_dir, ARGV[1]&.downcase == 'push')-updates.perform--if updates.failed.empty?- puts '', "All plugins updated successfully!", ''-else- if updates.failed.size < PluginTxUpdater::PLUGINS.size- puts '', "These plugins updated successfully: ", ''- puts PluginTxUpdater::PLUGINS - updates.failed- end- puts '', "Errors were encountered while updating these plugins:", ''- puts updates.failed-enddiff --git a/script/pull_translations.rb b/script/pull_translations.rbdeleted file mode 100755index 921da2772cb..00000000000--- a/script/pull_translations.rb+++ /dev/null@@ -1,60 +0,0 @@-#!/usr/bin/env ruby-# frozen_string_literal: true--require 'bundler/inline'--gemfile(true) do- gem 'translations-manager', git: 'https://github.com/discourse/translations-manager.git'-end--require 'translations_manager'--def expand_path(path)- File.expand_path("../../#{path}", __FILE__)-end--def supported_locales- Dir.glob(expand_path('config/locales/client.*.yml'))- .map { |x| x.split('.')[-2] }- .reject { |x| x.start_with?('en') }- .sort - TranslationsManager::BROKEN_LOCALES-end--YML_DIRS = ['config/locales',- 'plugins/poll/config/locales',- 'plugins/discourse-details/config/locales',- 'plugins/discourse-local-dates/config/locales',- 'plugins/discourse-narrative-bot/config/locales',- 'plugins/discourse-nginx-performance-report/config/locales',- 'plugins/discourse-presence/config/locales'].map { |dir| expand_path(dir) }-YML_FILE_PREFIXES = ['server', 'client']-TX_CONFIG = expand_path('.tx/config')-JS_LOCALE_DIR = expand_path('app/assets/javascripts/locales')--if ARGV.empty? && TranslationsManager::SUPPORTED_LOCALES != supported_locales- STDERR.puts <<~MESSAGE-- The supported locales are out of sync.- Please update the TranslationsManager::SUPPORTED_LOCALES in translations-manager.- https://github.com/discourse/translations-manager-- The following locales are currently supported by Discourse:-- MESSAGE-- STDERR.puts supported_locales.map { |l| "'#{l}'" }.join(",\n")- exit 1-end--TranslationsManager::TransifexUpdater.new(YML_DIRS, YML_FILE_PREFIXES, *ARGV).perform(tx_config_filename: TX_CONFIG)--TranslationsManager::SUPPORTED_LOCALES.each do |locale|- filename = File.join(JS_LOCALE_DIR, "#{locale}.js.erb")- next if File.exists?(filename)-- File.write(filename, <<~ERB)- //= depend_on 'client.#{locale}.yml'- //= require locales/i18n- <%= JsLocaleHelper.output_locale(:#{locale}) %>- ERB-enddiff --git a/script/push_translations.rb b/script/push_translations.rbdeleted file mode 100755index bebdbca46ef..00000000000--- a/script/push_translations.rb+++ /dev/null@@ -1,53 +0,0 @@-#!/usr/bin/env ruby-# frozen_string_literal: true--require 'bundler/inline'--gemfile(true) do- gem 'translations-manager', git: 'https://github.com/discourse/translations-manager.git'-end--require 'translations_manager'--def expand_path(path)- File.expand_path("../../#{path}", __FILE__)-end--YML_DIRS = ['config/locales',- 'plugins/poll/config/locales',- 'plugins/discourse-details/config/locales',- 'plugins/discourse-local-dates/config/locales',- 'plugins/discourse-narrative-bot/config/locales',- 'plugins/discourse-nginx-performance-report/config/locales',- 'plugins/discourse-presence/config/locales'].map { |dir| expand_path(dir) }-YML_FILE_PREFIXES = ['server', 'client']-TX_CONFIG = expand_path('.tx/config')--puts ""--resource_names = []-languages = []-parser = OptionParser.new do |opts|- opts.banner = "Usage: push_translations.rb [options]"-- opts.on("-r", "--resources a,b,c", Array, "Comma separated list of resource names as found in .tx/config") { |v| resource_names = v }- opts.on("-l", "--languages de,fr", Array, "Comma separated list of languages") { |v| languages = v }- opts.on("-h", "--help") do- puts opts- exit- end-end--begin- parser.parse!-rescue OptionParser::ParseError => e- STDERR.puts e.message, "", parser- exit 1-end--if resource_names.empty?- STDERR.puts "Missing argument: resources", "", parser- exit 1-end--TranslationsManager::TransifexUploader.new(YML_DIRS, YML_FILE_PREFIXES, resource_names, languages).perform(tx_config_filename: TX_CONFIG)diff --git a/translator.yml b/translator.ymlnew file mode 100644index 00000000000..9138a899a5d--- /dev/null+++ b/translator.yml@@ -0,0 +1,49 @@+# Configuration file for discourse-translator-bot++files:+ - source_path: config/locales/client.en.yml+ destination_path: client.yml+ - source_path: config/locales/server.en.yml+ destination_path: server.yml++ - source_path: public/403.html+ destination_path: error_pages/403.html++ - source_path: public/422.html+ destination_path: error_pages/422.html++ - source_path: public/500.html+ destination_path: error_pages/500.html++ - source_path: public/503.html+ destination_path: error_pages/503.html++ - source_path: plugins/discourse-details/config/locales/client.en.yml+ destination_path: plugins/details/client.yml+ - source_path: plugins/discourse-details/config/locales/server.en.yml+ destination_path: plugins/details/server.yml++ - source_path: plugins/discourse-local-dates/config/locales/client.en.yml+ destination_path: plugins/local-dates/client.yml+ - source_path: plugins/discourse-local-dates/config/locales/server.en.yml+ destination_path: plugins/local-dates/server.yml++ - source_path: plugins/discourse-narrative-bot/config/locales/client.en.yml+ destination_path: plugins/narrative-bot/client.yml+ - source_path: plugins/discourse-narrative-bot/config/locales/server.en.yml+ destination_path: plugins/narrative-bot/server.yml++ - source_path: plugins/discourse-presence/config/locales/client.en.yml+ destination_path: plugins/presence/client.yml+ - source_path: plugins/discourse-presence/config/locales/server.en.yml+ destination_path: plugins/presence/server.yml++ - source_path: plugins/discourse-unsupported-browser/config/locales/client.en.yml+ destination_path: plugins/unsupported-browser/client.yml+ - source_path: plugins/discourse-unsupported-browser/config/locales/server.en.yml+ destination_path: plugins/unsupported-browser/server.yml++ - source_path: plugins/poll/config/locales/client.en.yml+ destination_path: plugins/poll/client.yml+ - source_path: plugins/poll/config/locales/server.en.yml+ destination_path: plugins/poll/server.yml