mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06: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
@@ -104,4 +104,24 @@ describe I18n::Backend::DiscourseI18n do
|
||||
expect { backend.translate(:ru, :airplanes, count: 2) }.to raise_error(I18n::InvalidPluralizationData)
|
||||
end
|
||||
end
|
||||
|
||||
describe ".sort_local_files" do
|
||||
it "sorts an array of client ymls with '-(highest-number)' being last" do
|
||||
expect(I18n::Backend::DiscourseI18n.sort_locale_files(
|
||||
[
|
||||
'discourse/plugins/discourse-second/config/locales/client-99.es.yml',
|
||||
'discourse/plugins/discourse-first/config/locales/client.es.yml',
|
||||
'discourse/plugins/discourse-third/config/locales/client-2.es.yml',
|
||||
'discourse/plugins/discourse-third/config/locales/client-3.bs_BA.yml',
|
||||
]
|
||||
)).to eq(
|
||||
[
|
||||
'discourse/plugins/discourse-first/config/locales/client.es.yml',
|
||||
'discourse/plugins/discourse-third/config/locales/client-2.es.yml',
|
||||
'discourse/plugins/discourse-third/config/locales/client-3.bs_BA.yml',
|
||||
'discourse/plugins/discourse-second/config/locales/client-99.es.yml',
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user