From 6d44be5142d67a435fcc80694a707d64bb9c0ad5 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Sat, 11 May 2019 01:50:17 +0200 Subject: [PATCH] FIX: Catch InvalidPluralizationData exception in fallback locales It shouldn't raise an exception when a pluralized string in a fallback locale is only partially translated. --- lib/i18n/backend/discourse_i18n.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/i18n/backend/discourse_i18n.rb b/lib/i18n/backend/discourse_i18n.rb index ad5313cc1a6..6578091f6db 100644 --- a/lib/i18n/backend/discourse_i18n.rb +++ b/lib/i18n/backend/discourse_i18n.rb @@ -25,6 +25,15 @@ module I18n end end + def pluralize(locale, entry, count) + begin + super + rescue I18n::InvalidPluralizationData => e + raise e if I18n.fallbacks[locale] == [locale] + throw(:exception, e) + end + end + def self.create_search_regexp(query, as_string: false) regexp = Regexp.escape(query)