Do not create empty files when pulling from Transifex
This commit is contained in:
parent
09c4491f73
commit
8412a96acb
|
@ -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 = <<END
|
|||
# https://www.transifex.com/projects/p/discourse-org/
|
||||
END
|
||||
|
||||
def yml_path_if_exists(dir, prefix, language)
|
||||
path = yml_path(dir, prefix, language)
|
||||
File.exists?(path) ? path : nil
|
||||
end
|
||||
|
||||
# Add comments to the top of files and replace the language (first key in YAML file)
|
||||
def update_file_header(filename, language)
|
||||
lines = File.readlines(filename)
|
||||
|
|
Loading…
Reference in New Issue