UX: Allow correct pluralization for "too few topics and posts" notices (#8947)

This commit is contained in:
Gerhard Schlager
2020-03-02 20:20:37 +01:00
committed by GitHub
parent 8e7868b405
commit 5c39e21c18
2 changed files with 21 additions and 8 deletions

View File

@@ -68,21 +68,21 @@ export default Component.extend({
"topicTrackingState.incomingCount"
)
message() {
var msg = null;
let msg = null;
if (
this.publicTopicCount < this.requiredTopics &&
this.publicPostCount < this.requiredPosts
) {
msg = "too_few_topics_and_posts_notice";
msg = "too_few_topics_and_posts_notice_MF";
} else if (this.publicTopicCount < this.requiredTopics) {
msg = "too_few_topics_notice";
msg = "too_few_topics_notice_MF";
} else {
msg = "too_few_posts_notice";
msg = "too_few_posts_notice_MF";
}
return new Handlebars.SafeString(
I18n.t(msg, {
I18n.messageFormat(msg, {
requiredTopics: this.requiredTopics,
requiredPosts: this.requiredPosts,
currentTopics: this.publicTopicCount,

View File

@@ -1372,9 +1372,22 @@ en:
enabled: "This site is in read only mode. Please continue to browse, but replying, likes, and other actions are disabled for now."
login_disabled: "Login is disabled while the site is in read only mode."
logout_disabled: "Logout is disabled while the site is in read only mode."
too_few_topics_and_posts_notice: "Let's <a href='https://blog.discourse.org/2014/08/building-a-discourse-community/'>start the discussion!</a> There are <strong>%{currentTopics}</strong> topics and <strong>%{currentPosts}</strong> posts. Visitors need more to read and reply to we recommend at least <strong>%{requiredTopics}</strong> topics and <strong>%{requiredPosts}</strong> posts. Only staff can see this message."
too_few_topics_notice: "Let's <a href='https://blog.discourse.org/2014/08/building-a-discourse-community/'>start the discussion!</a> There are <strong>%{currentTopics}</strong> topics. Visitors need more to read and reply to we recommend at least <strong>%{requiredTopics}</strong> topics. Only staff can see this message."
too_few_posts_notice: "Let's <a href='https://blog.discourse.org/2014/08/building-a-discourse-community/'>start the discussion!</a> There are <strong>%{currentPosts}</strong> posts. Visitors need more to read and reply to we recommend at least <strong>%{requiredPosts}</strong> posts. Only staff can see this message."
too_few_topics_and_posts_notice_MF: >-
Let's <a href="https://blog.discourse.org/2014/08/building-a-discourse-community/">start the discussion!</a>
There {currentTopics, plural, one {is <strong>#</strong> topic} other {are <strong>#</strong> topics}} and
{currentPosts, plural, one {<strong>#</strong> post} other {<strong>#</strong> posts}}. Visitors need more to
read and reply to we recommend at least {requiredTopics, plural, one {<strong>#</strong> topic} other {<strong>#</strong> topics}}
and {requiredPosts, plural, one {<strong>#</strong> post} other {<strong>#</strong> posts}}. Only staff can see this message.
too_few_topics_notice_MF: >-
Let's <a href="https://blog.discourse.org/2014/08/building-a-discourse-community/">start the discussion!</a>
There {currentTopics, plural, one {is <strong>#</strong> topic} other {are <strong>#</strong> topics}}. Visitors need more to
read and reply to we recommend at least {requiredTopics, plural, one {<strong>#</strong> topic} other {<strong>#</strong> topics}}.
Only staff can see this message.
too_few_posts_notice_MF: >-
Let's <a href="https://blog.discourse.org/2014/08/building-a-discourse-community/">start the discussion!</a>
There {currentPosts, plural, one {is <strong>#</strong> post} other {are <strong>#</strong> posts}}. Visitors need more to
read and reply to we recommend at least {requiredPosts, plural, one {<strong>#</strong> post} other {<strong>#</strong> posts}}.
Only staff can see this message.
logs_error_rate_notice:
# keys ending with _MF use message format, see https://meta.discourse.org/t/message-format-support-for-localization/7035 for details
reached_hour_MF: "<b>{relativeAge}</b> <a href='{url}' target='_blank'>{rate, plural, one {# error/hour} other {# errors/hour}}</a> reached site setting limit of {limit, plural, one {# error/hour} other {# errors/hour}}."