mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 16:21:18 +08:00
DEV: Add plugins client/server translation yml file priority structure (#11194)
Plugin client.en.yml and server.en.yml can now be client/server-(1-100).en.yml. 1 is the lowest priority, and 100 is the highest priority. This allows plugins to set their priority higher than other plugins, so that they can override eachothers' translations.
This commit is contained in:

committed by
GitHub

parent
a48f7ba61c
commit
be07853cc1
@ -886,8 +886,8 @@ class Plugin::Instance
|
||||
|
||||
locales.each do |locale, opts|
|
||||
opts = opts.dup
|
||||
opts[:client_locale_file] = File.join(root_path, "config/locales/client.#{locale}.yml")
|
||||
opts[:server_locale_file] = File.join(root_path, "config/locales/server.#{locale}.yml")
|
||||
opts[:client_locale_file] = Dir["#{root_path}/config/locales/client*.#{locale}.yml"].first || ""
|
||||
opts[:server_locale_file] = Dir["#{root_path}/config/locales/server*.#{locale}.yml"].first || ""
|
||||
opts[:js_locale_file] = File.join(root_path, "assets/locales/#{locale}.js.erb")
|
||||
|
||||
locale_chain = opts[:fallbackLocale] ? [locale, opts[:fallbackLocale]] : [locale]
|
||||
|
Reference in New Issue
Block a user