Merge "[BrowserTest] Use English if i18n file does not exists to convert the text"

This commit is contained in:
jenkins-bot 2015-10-12 15:21:35 +00:00 committed by Gerrit Code Review
commit 1da509937d

View file

@ -3,8 +3,13 @@
#
module VisualEditorHelper
def translate(string)
file = File.read "i18n/#{lookup(:language_screenshot_code)}.json"
file = File.read i18n_file
json = JSON.parse(file)
json["visualeditor-languagescreenshot-#{string.downcase.gsub(' ', '-')}-text"] || ''
end
def i18n_file
language = lookup(:language_screenshot_code)
(File.exist?("i18n/#{language}.json")) ? "i18n/#{language}.json" : 'i18n/en.json'
end
end