diff --git a/script/pull_translations.rb b/script/pull_translations.rb new file mode 100644 index 000000000..0c34e1f24 --- /dev/null +++ b/script/pull_translations.rb @@ -0,0 +1,81 @@ +# This script pulls translation files from Transifex and ensures they are in the format we need. +# You need the Transifex client installed. +# http://docs.transifex.com/developer/client/setup +# +# Don't use this script to create pull requests. Do translations in Transifex. The Discourse +# team will pull them in. + +require 'open3' + +if `which tx`.strip.empty? + puts "", "The Transifex client needs to be installed to use this script." + puts "Instructions are here: http://docs.transifex.com/developer/client/setup" + puts "", "On Mac:", "" + puts " curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py" + puts " sudo python get-pip.py" + puts " sudo pip install transifex-client", "" + exit 1 +end + +puts "Pulling new translations...", "" +# TODO: The following tx command may need to always use "-f" to force pull all translations. +# I don't understand how it decides to skip some files, but it seems to skip +# even when there are new translations on the server sometimes. +Open3.popen2e('tx pull --mode=developer') do |stdin, stdout_err, wait_thr| + while line = stdout_err.gets + puts line + end +end +puts "" + +if !$?.success? + puts "Something failed. Check the output above.", "" + exit $?.exitstatus +end + +yml_file_comments = <