From 8412a96acb9d2e9144a1cacb9cdf919b57a81abf Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Fri, 6 Apr 2018 14:47:25 +0200 Subject: [PATCH] Do not create empty files when pulling from Transifex --- script/pull_translations.rb | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/script/pull_translations.rb b/script/pull_translations.rb index a82abce68e0..8b5faedb413 100644 --- a/script/pull_translations.rb +++ b/script/pull_translations.rb @@ -48,11 +48,18 @@ def yml_path(dir, prefix, language) File.expand_path(path, __FILE__) end +def yml_path_if_exists(dir, prefix, language) + path = yml_path(dir, prefix, language) + File.exists?(path) ? path : nil +end + languages = get_languages.select { |x| x != 'en' }.sort # ensure that all locale files exists. tx doesn't create missing locale files during pull YML_DIRS.each do |dir| YML_FILE_PREFIXES.each do |prefix| + next unless yml_path_if_exists(dir, prefix, 'en') + languages.each do |language| filename = yml_path(dir, prefix, language) FileUtils.touch(filename) unless File.exists?(filename) @@ -86,11 +93,6 @@ YML_FILE_COMMENTS = <