mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-24 14:33:59 +00:00
Merge "[BrowserTest] Fix i18n files lookup"
This commit is contained in:
commit
b779743208
|
@ -6,7 +6,12 @@ class VisualEditorPage
|
|||
|
||||
def self.translate(string)
|
||||
language = ENV['LANGUAGE_SCREENSHOT_CODE']
|
||||
file_name = (File.exist?("../../i18n/#{language}.json")) ? "../../i18n/#{language}.json" : '../../i18n/en.json'
|
||||
|
||||
file_name = File.expand_path("../../../i18n/#{language}.json", __dir__)
|
||||
unless File.exist?(file_name)
|
||||
file_name = File.expand_path('../../../i18n/en.json', __dir__)
|
||||
end
|
||||
|
||||
json = JSON.parse(File.read(file_name))
|
||||
json[string] || ''
|
||||
end
|
||||
|
|
|
@ -10,6 +10,10 @@ module VisualEditorHelper
|
|||
|
||||
def i18n_file
|
||||
language = lookup(:language_screenshot_code)
|
||||
(File.exist?("i18n/#{language}.json")) ? "i18n/#{language}.json" : 'i18n/en.json'
|
||||
file_name = File.expand_path("../../i18n/#{language}.json", __dir__)
|
||||
unless File.exist?(file_name)
|
||||
file_name = File.expand_path('../../i18n/en.json', __dir__)
|
||||
end
|
||||
file_name
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue