FIX: Pluralize logs notice message.

This commit is contained in:
Guo Xiang Tan 2016-03-24 09:11:58 +08:00
parent fd853e0776
commit 621372eb7b
2 changed files with 12 additions and 5 deletions

View file

@ -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')
})
);

View file

@ -795,7 +795,12 @@ en:
too_few_topics_and_posts_notice: "Let's <a href='http://blog.discourse.org/2014/08/building-a-discourse-community/'>get this discussion started!</a> There are currently <strong>%{currentTopics} / %{requiredTopics}</strong> topics and <strong>%{currentPosts} / %{requiredPosts}</strong> posts. New visitors need some conversations to read and respond to."
too_few_topics_notice: "Let's <a href='http://blog.discourse.org/2014/08/building-a-discourse-community/'>get this discussion started!</a> There are currently <strong>%{currentTopics} / %{requiredTopics}</strong> topics. New visitors need some conversations to read and respond to."
too_few_posts_notice: "Let's <a href='http://blog.discourse.org/2014/08/building-a-discourse-community/'>get this discussion started!</a> There are currently <strong>%{currentPosts} / %{requiredPosts}</strong> posts. New visitors need some conversations to read and respond to."
logs_error_rate_exceeded_notice: "%{timestamp}: Current rate of <a href='%{url}' target='_blank'>%{rate} errors/%{duration}</a> has exceeded site settings's limit of %{siteSettingLimit} errors/%{duration}."
logs_error_rate_notice:
reached: "%{timestamp}: Current rate of <a href='%{url}' target='_blank'>%{rate}</a> has reached site settings's limit of %{siteSettingRate}."
exceeded: "%{timestamp}: Current rate of <a href='%{url}' target='_blank'>%{rate}</a> has exceeded site settings's limit of %{siteSettingRate}."
rate:
one: "1 error/%{duration}"
other: "%{count} errors/%{duration}"
learn_more: "learn more..."