mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 00:43:24 +08:00
a2c04be718
FIX: client's translation overrides were not working when the current locale was missing a key FIX: ExtraLocalesController.show was not properly handling multiple translations FIX: JsLocaleHelper#output_locale was not properly handling multiple translations FIX: ExtraLocalesController.show's spec which was randomly failing FIX: JsLocaleHelper#output_locale was muting cached translations hashes REFACTOR: move 'enableVerboseLocalization' to the 'localization' initializer REFACTOR: remove unused I18n.js methods (getFallbacks, localize, parseDate, toTime, strftime, toCurrency, toPercentage) REFACTOR: remove all I18n.pluralizationRules and instead use MessageFormat's pluralization rules TEST: add tests for localization initializer TEST: add tests for I18n.js
45 lines
1.1 KiB
Ruby
45 lines
1.1 KiB
Ruby
require 'rails_helper'
|
|
|
|
describe ExtraLocalesController do
|
|
|
|
context 'show' do
|
|
|
|
it "needs a valid bundle" do
|
|
get :show, bundle: 'made-up-bundle'
|
|
expect(response).to_not be_success
|
|
expect(response.body).to be_blank
|
|
end
|
|
|
|
it "won't work with a weird parameter" do
|
|
get :show, bundle: '-invalid..character!!'
|
|
expect(response).to_not be_success
|
|
end
|
|
|
|
it "includes plugin translations" do
|
|
I18n.locale = :en
|
|
I18n.reload!
|
|
|
|
JsLocaleHelper.expects(:plugin_translations)
|
|
.with(I18n.locale.to_s)
|
|
.returns({
|
|
"admin_js" => {
|
|
"admin" => {
|
|
"site_settings" => {
|
|
"categories" => {
|
|
"github_badges" => "Github Badges"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}).at_least_once
|
|
|
|
get :show, bundle: "admin"
|
|
|
|
expect(response).to be_success
|
|
expect(response.body.include?("github_badges")).to eq(true)
|
|
end
|
|
|
|
end
|
|
|
|
end
|