diff --git a/app/assets/javascripts/discourse/services/logs-notice.js.es6 b/app/assets/javascripts/discourse/services/logs-notice.js.es6 index 8948de3a1..07ad6acd0 100644 --- a/app/assets/javascripts/discourse/services/logs-notice.js.es6 +++ b/app/assets/javascripts/discourse/services/logs-notice.js.es6 @@ -15,6 +15,7 @@ const LogsNotice = Ember.Object.extend({ this.messageBus.subscribe("/logs_error_rate_exceeded", data => { const duration = data.duration; + const rate = data.rate; var siteSettingLimit = 0; if (duration === 'minute') { @@ -23,12 +24,13 @@ const LogsNotice = Ember.Object.extend({ siteSettingLimit = this.siteSettings.alert_admins_if_errors_per_hour; } + var translationKey = (rate === siteSettingLimit) ? 'reached' : 'exceeded'; + this.set('text', - I18n.t('logs_error_rate_exceeded_notice', { + I18n.t(`logs_error_rate_notice.${translationKey}`, { timestamp: moment().format("YYYY-MM-DD H:mm:ss"), - siteSettingLimit: siteSettingLimit, - rate: data.rate, - duration: duration, + siteSettingRate: I18n.t('logs_error_rate_notice.rate', { count: siteSettingLimit, duration: duration }), + rate: I18n.t('logs_error_rate_notice.rate', { count: rate, duration: duration }), url: Discourse.getURL('/logs') }) ); diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 7b3f76284..6e118b47f 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -795,7 +795,12 @@ en: too_few_topics_and_posts_notice: "Let's get this discussion started! There are currently %{currentTopics} / %{requiredTopics} topics and %{currentPosts} / %{requiredPosts} posts. New visitors need some conversations to read and respond to." too_few_topics_notice: "Let's get this discussion started! There are currently %{currentTopics} / %{requiredTopics} topics. New visitors need some conversations to read and respond to." too_few_posts_notice: "Let's get this discussion started! There are currently %{currentPosts} / %{requiredPosts} posts. New visitors need some conversations to read and respond to." - logs_error_rate_exceeded_notice: "%{timestamp}: Current rate of %{rate} errors/%{duration} has exceeded site settings's limit of %{siteSettingLimit} errors/%{duration}." + logs_error_rate_notice: + reached: "%{timestamp}: Current rate of %{rate} has reached site settings's limit of %{siteSettingRate}." + exceeded: "%{timestamp}: Current rate of %{rate} has exceeded site settings's limit of %{siteSettingRate}." + rate: + one: "1 error/%{duration}" + other: "%{count} errors/%{duration}" learn_more: "learn more..."