From 584abbda54e3792b03e9a8456667c6bac5f75f87 Mon Sep 17 00:00:00 2001 From: Gerhard Schlager Date: Sat, 10 Dec 2022 15:31:37 +0100 Subject: [PATCH] REFACTOR: Update Message Format string to simplify translation --- .../app/components/suggested-topics.js | 4 +- config/locales/client.en.yml | 113 ++++++++++++------ 2 files changed, 80 insertions(+), 37 deletions(-) diff --git a/app/assets/javascripts/discourse/app/components/suggested-topics.js b/app/assets/javascripts/discourse/app/components/suggested-topics.js index fbcb952c357..66c7d9fd656 100644 --- a/app/assets/javascripts/discourse/app/components/suggested-topics.js +++ b/app/assets/javascripts/discourse/app/components/suggested-topics.js @@ -50,7 +50,7 @@ export default Component.extend({ if (suggestedGroupName) { return I18n.messageFormat("user.messages.read_more_group_pm_MF", { - BOTH: hasBoth, + HAS_UNREAD_AND_NEW: hasBoth, UNREAD: unreadCount, NEW: newCount, username, @@ -60,7 +60,7 @@ export default Component.extend({ }); } else { return I18n.messageFormat("user.messages.read_more_personal_pm_MF", { - BOTH: hasBoth, + HAS_UNREAD_AND_NEW: hasBoth, UNREAD: unreadCount, NEW: newCount, username, diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 515419eba0e..a093f98215f 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1295,35 +1295,71 @@ en: read_more_in_group: "Want to read more? Browse other messages in %{groupLink}." read_more: "Want to read more? Browse other messages in personal messages." - read_more_group_pm_MF: "There { - UNREAD, plural, - =0 {} - one { - is # unread - } other { - are # unread + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. + # + # Both UNREAD and NEW are greater than 0 when HAS_UNREAD_AND_NEW is true + # Either UNREAD or NEW is greater than 0 when HAS_UNREAD_AND_NEW is false + read_more_group_pm_MF: | + { HAS_UNREAD_AND_NEW, select, + true { + { UNREAD, plural, + =0 {} + one { There is # unread } + other { There are # unread } + } + { NEW, plural, + =0 {} + one { and # new message remaining, or browse other messages in {groupLink} } + other { and # new messages remaining, or browse other messages in {groupLink} } + } + } + false { + { UNREAD, plural, + =0 {} + one { There is # unread message remaining, or browse other messages in {groupLink} } + other { There are # unread messages remaining, or browse other messages in {groupLink} } + } + { NEW, plural, + =0 {} + one { There is # new message remaining, or browse other messages in {groupLink} } + other { There are # new messages remaining, or browse other messages in {groupLink} } + } + } + other {} } - } { - NEW, plural, - =0 {} - one { {BOTH, select, true{and } false {is } other{}} # new message} - other { {BOTH, select, true{and } false {are } other{}} # new messages} - } remaining, or browse other messages in {groupLink}" - read_more_personal_pm_MF: "There { - UNREAD, plural, - =0 {} - one { - is # unread - } other { - are # unread + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. + # + # Both UNREAD and NEW are greater than 0 when HAS_UNREAD_AND_NEW is true + # Either UNREAD or NEW is greater than 0 when HAS_UNREAD_AND_NEW is false + read_more_personal_pm_MF: | + { HAS_UNREAD_AND_NEW, select, + true { + { UNREAD, plural, + =0 {} + one { There is # unread } + other { There are # unread } + } + { NEW, plural, + =0 {} + one { and # new message remaining, or browse other personal messages } + other { and # new messages remaining, or browse other personal messages } + } + } + false { + { UNREAD, plural, + =0 {} + one { There is # unread message remaining, or browse other personal messages } + other { There are # unread messages remaining, or browse other personal messages } + } + { NEW, plural, + =0 {} + one { There is # new message remaining, or browse other personal messages } + other { There are # new messages remaining, or browse other personal messages } + } + } + other {} } - } { - NEW, plural, - =0 {} - one { {BOTH, select, true{and } false {is } other{}} # new message} - other { {BOTH, select, true{and } false {are } other{}} # new messages} - } remaining, or browse other personal messages" preferences_nav: account: "Account" @@ -1893,30 +1929,36 @@ en: logout_disabled: "Logout is disabled while the site is in read only mode." staff_writes_only_mode: enabled: "This site is in staff only mode. Please continue to browse, but replying, likes, and other actions are limited to staff members only." + + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. too_few_topics_and_posts_notice_MF: >- Let's start the discussion! There {currentTopics, plural, one {is # topic} other {are # topics}} and {currentPosts, plural, one {# post} other {# posts}}. Visitors need more to read and reply to – we recommend at least {requiredTopics, plural, one {# topic} other {# topics}} and {requiredPosts, plural, one {# post} other {# posts}}. Only staff can see this message. + + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. too_few_topics_notice_MF: >- Let's start the discussion! There {currentTopics, plural, one {is # topic} other {are # topics}}. Visitors need more to read and reply to – we recommend at least {requiredTopics, plural, one {# topic} other {# topics}}. Only staff can see this message. + + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. too_few_posts_notice_MF: >- Let's start the discussion! There {currentPosts, plural, one {is # post} other {are # posts}}. Visitors need more to read and reply to – we recommend at least {requiredPosts, plural, one {# post} other {# 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 + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. reached_hour_MF: "{relativeAge}{rate, plural, one {# error/hour} other {# errors/hour}} reached site setting limit of {limit, plural, one {# error/hour} other {# errors/hour}}." - # keys ending with _MF use message format, see https://meta.discourse.org/t/message-format-support-for-localization/7035 for details + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. reached_minute_MF: "{relativeAge}{rate, plural, one {# error/minute} other {# errors/minute}} reached site setting limit of {limit, plural, one {# error/minute} other {# errors/minute}}." - # keys ending with _MF use message format, see https://meta.discourse.org/t/message-format-support-for-localization/7035 for details + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. exceeded_hour_MF: "{relativeAge}{rate, plural, one {# error/hour} other {# errors/hour}} exceeded site setting limit of {limit, plural, one {# error/hour} other {# errors/hour}}." - # keys ending with _MF use message format, see https://meta.discourse.org/t/message-format-support-for-localization/7035 for details + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. exceeded_minute_MF: "{relativeAge}{rate, plural, one {# error/minute} other {# errors/minute}} exceeded site setting limit of {limit, plural, one {# error/minute} other {# errors/minute}}." learn_more: "learn more..." @@ -1948,7 +1990,7 @@ en: description: one: "There is %{count} reply." other: "There are %{count} replies." - # keys ending with _MF use message format, see https://meta.discourse.org/t/message-format-support-for-localization/7035 for details + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. description_time_MF: "There {replyCount, plural, one {is # reply} other {are # replies}} with an estimated read time of {readingTime, plural, one {# minute} other {# minutes}}." enable: "Summarize This Topic" disable: "Show All Posts" @@ -2825,7 +2867,7 @@ en: read_more: "Want to read more? %{catLink} or %{latestLink}." unread_indicator: "No member has read the last post of this topic yet." - # keys ending with _MF use message format, see https://meta.discourse.org/t/message-format-support-for-localization/7035 for details + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. read_more_MF: "There { UNREAD, plural, =0 {} @@ -2841,6 +2883,7 @@ en: other { {BOTH, select, true{and } false {are } other{}} # new topics} } remaining, or {CATEGORY, select, true {browse other topics in {catLink}} false {{latestLink}} other {}}" + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. bumped_at_title_MF: "{FIRST_POST}: {CREATED_AT}\n{LAST_POST}: {BUMPED_AT}" browse_all_categories: Browse all categories @@ -3657,7 +3700,7 @@ en: delete_spammer: "Delete Spammer" flag_for_review: "Queue For Review" - # keys ending with _MF use message format, see https://meta.discourse.org/t/message-format-support-for-localization/7035 for details + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. delete_confirm_MF: "You are about to delete {POSTS, plural, one {# post} other {# posts}} and {TOPICS, plural, one {# topic} other {# topics}} from this user, remove their account, block signups from their IP address {ip_address}, and add their email address {email} to a permanent block list. Are you sure this user is really a spammer?" yes_delete_spammer: "Yes, Delete Spammer" ip_address_missing: "(N/A)" @@ -3732,7 +3775,7 @@ en: label: "Pending" label_with_count: "Pending (%{count})" - # keys ending with _MF use message format, see https://meta.discourse.org/t/message-format-support-for-localization/7035 for details + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. posts_likes_MF: | This topic has {count, plural, one {# reply} other {# replies}} {ratio, select, low {with a high like to post ratio} @@ -5424,7 +5467,7 @@ en: title: "Clear Penalty History" description: "users with penalties cannot reach TL3" - # keys ending with _MF use message format, see https://meta.discourse.org/t/message-format-support-for-localization/7035 for details + # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. delete_all_posts_confirm_MF: "You are about to delete {POSTS, plural, one {# post} other {# posts}} and {TOPICS, plural, one {# topic} other {# topics}}. Are you sure?" silence: "Silence" unsilence: "Unsilence"