From 12ab515ecd448f98ff006e30a93e43626183b6d0 Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 15 Jun 2015 17:12:05 -0700 Subject: imported new locales from transifex --- lib/tasks/i18n.rake | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/tasks/i18n.rake b/lib/tasks/i18n.rake index 5ccc65e..2392d8a 100644 --- a/lib/tasks/i18n.rake +++ b/lib/tasks/i18n.rake @@ -47,14 +47,21 @@ namespace :i18n do end end - - # elijah: this does not actually work, but I think could be a starting point - # for something that will work. desc "pull translations from transifex" task :download do - Conf.enabled_languages.each do |lang| - next unless lang == 'en' - `curl -L --user #{Conf.transifex_user}:#{Conf.transifex_password} -X GET https://www.transifex.net/api/2/project/crabgrass/resource/master/translation/#{lang}/?file > config/locales/#{lang}.yml` + Dir.chdir('config/') do + if !File.exists?('transifex.netrc') + puts "In order to download translations, you need a config/transifex.netrc file." + puts "For example:" + puts "machine www.transifex.com login yourusername password yourpassword" + exit + end + APP_CONFIG[:available_locales].each do |lang| + next if lang == :en + puts "downloading #{lang}" + `curl -L --netrc-file transifex.netrc -X GET 'https://www.transifex.com/api/2/project/bitmask/resource/leap_web/translation/#{lang}/?file' > locales/#{lang}.yml` + end end end + end -- cgit v1.2.3