mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-09-25 11:16:51 +00:00
Merge "[BrowserTest] Use English if i18n file does not exists to convert the text"
This commit is contained in:
commit
1da509937d
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue