mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 02:40:53 -06:00
Revert "DEV: Output failing MF keys when compilation fails" (#29200)
This reverts commit 8eff922ace
.
This commit is contained in:
parent
448fae6ea5
commit
d92d65fe73
@ -163,17 +163,7 @@ module JsLocaleHelper
|
|||||||
require("discourse-mf");
|
require("discourse-mf");
|
||||||
JS
|
JS
|
||||||
rescue => e
|
rescue => e
|
||||||
message_formats[locale.to_s]
|
Rails.logger.error("Failed to compile message formats for #{locale} '#{e}'")
|
||||||
.filter_map do |key, value|
|
|
||||||
next if MessageFormat.compile(locale, value, strict: false)
|
|
||||||
rescue StandardError
|
|
||||||
key
|
|
||||||
end
|
|
||||||
.then do |strings|
|
|
||||||
Rails.logger.error(
|
|
||||||
"Failed to compile message formats for #{locale}.\n\nBroken strings are: #{strings.join(", ")}\n\nError: #{e}",
|
|
||||||
)
|
|
||||||
end
|
|
||||||
<<~JS
|
<<~JS
|
||||||
console.error("Failed to compile message formats for #{locale}. Some translation strings will be missing.");
|
console.error("Failed to compile message formats for #{locale}. Some translation strings will be missing.");
|
||||||
JS
|
JS
|
||||||
|
@ -169,10 +169,8 @@ RSpec.describe JsLocaleHelper do
|
|||||||
let(:translated_message) do
|
let(:translated_message) do
|
||||||
v8_ctx.eval("I18n._mfMessages.get('posts_likes_MF', {count: 3, ratio: 'med'})")
|
v8_ctx.eval("I18n._mfMessages.get('posts_likes_MF', {count: 3, ratio: 'med'})")
|
||||||
end
|
end
|
||||||
let(:fake_logger) { FakeLogger.new }
|
|
||||||
|
|
||||||
before do
|
before do
|
||||||
Rails.logger.broadcast_to(fake_logger)
|
|
||||||
overriden_translation_ja.update_columns(
|
overriden_translation_ja.update_columns(
|
||||||
value: "{ count, plural, one {返信 # 件、} other {返信 # 件、} }",
|
value: "{ count, plural, one {返信 # 件、} other {返信 # 件、} }",
|
||||||
)
|
)
|
||||||
@ -180,8 +178,6 @@ RSpec.describe JsLocaleHelper do
|
|||||||
v8_ctx.eval(output)
|
v8_ctx.eval(output)
|
||||||
end
|
end
|
||||||
|
|
||||||
after { Rails.logger.stop_broadcasting_to(fake_logger) }
|
|
||||||
|
|
||||||
context "when locale is 'en'" do
|
context "when locale is 'en'" do
|
||||||
let(:locale) { "en" }
|
let(:locale) { "en" }
|
||||||
|
|
||||||
@ -262,11 +258,6 @@ RSpec.describe JsLocaleHelper do
|
|||||||
it "raises an error" do
|
it "raises an error" do
|
||||||
expect(output).to match(/Failed to compile message formats/)
|
expect(output).to match(/Failed to compile message formats/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "logs which keys are problematic" do
|
|
||||||
output
|
|
||||||
expect(fake_logger.errors).to include(/posts_likes_MF/)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user