mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
Fix broken specs.
This commit is contained in:
@ -72,9 +72,11 @@ module I18n
|
|||||||
# the original translations before applying our overrides.
|
# the original translations before applying our overrides.
|
||||||
def lookup(locale, key, scope = [], options = {})
|
def lookup(locale, key, scope = [], options = {})
|
||||||
existing_translations = super(locale, key, scope, options)
|
existing_translations = super(locale, key, scope, options)
|
||||||
|
return existing_translations if scope.is_a?(Array) && scope.include?(:models)
|
||||||
|
|
||||||
overrides = options.dig(:overrides, locale)
|
overrides = options.dig(:overrides, locale)
|
||||||
|
|
||||||
if overrides && !scope&.include?(:models)
|
if overrides
|
||||||
if existing_translations && options[:count]
|
if existing_translations && options[:count]
|
||||||
remapped_translations =
|
remapped_translations =
|
||||||
if existing_translations.is_a?(Hash)
|
if existing_translations.is_a?(Hash)
|
||||||
|
@ -176,7 +176,7 @@ describe I18n::Backend::DiscourseI18n do
|
|||||||
expect(I18n.with_locale(:ru) { I18n.translate('got', default: '') }).to eq('summer')
|
expect(I18n.with_locale(:ru) { I18n.translate('got', default: '') }).to eq('summer')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'supports ActiveModel::Naming#human' do
|
it 'does not affect ActiveModel::Naming#human' do
|
||||||
Fish = Class.new(ActiveRecord::Base)
|
Fish = Class.new(ActiveRecord::Base)
|
||||||
|
|
||||||
TranslationOverride.upsert!('en', 'fish', "fake fish")
|
TranslationOverride.upsert!('en', 'fish', "fake fish")
|
||||||
|
Reference in New Issue
Block a user