diff --git a/app/assets/javascripts/discourse/app/components/suggested-topics.js b/app/assets/javascripts/discourse/app/components/suggested-topics.js index 66c7d9fd656..ad0c6671706 100644 --- a/app/assets/javascripts/discourse/app/components/suggested-topics.js +++ b/app/assets/javascripts/discourse/app/components/suggested-topics.js @@ -80,11 +80,6 @@ export default Component.extend({ }, _topicBrowseMoreMessage(topic) { - const opts = { - latestLink: `${I18n.t( - "topic.view_latest_topics" - )}`, - }; let category = topic.get("category"); if ( @@ -94,17 +89,6 @@ export default Component.extend({ category = null; } - if (category) { - opts.catLink = categoryBadgeHTML(category); - } else { - opts.catLink = - '' + - I18n.t("topic.browse_all_categories") + - ""; - } - let unreadTopics = 0; let newTopics = 0; @@ -114,21 +98,24 @@ export default Component.extend({ } if (newTopics + unreadTopics > 0) { - const hasBoth = unreadTopics > 0 && newTopics > 0; - return I18n.messageFormat("topic.read_more_MF", { - BOTH: hasBoth, + HAS_UNREAD_AND_NEW: unreadTopics > 0 && newTopics > 0, UNREAD: unreadTopics, NEW: newTopics, - CATEGORY: category ? true : false, - latestLink: opts.latestLink, - catLink: opts.catLink, + HAS_CATEGORY: category ? true : false, + categoryLink: category ? categoryBadgeHTML(category) : null, basePath: getURL(""), }); } else if (category) { - return I18n.t("topic.read_more_in_category", opts); + return I18n.t("topic.read_more_in_category", { + categoryLink: categoryBadgeHTML(category), + latestLink: getURL("/latest"), + }); } else { - return I18n.t("topic.read_more", opts); + return I18n.t("topic.read_more", { + categoryLink: getURL("/categories"), + latestLink: getURL("/latest"), + }); } }, diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index a093f98215f..0b74d42eb62 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -2863,25 +2863,47 @@ en: show_links: "show links within this topic" collapse_details: "collapse topic details" expand_details: "expand topic details" - read_more_in_category: "Want to read more? Browse other topics in %{catLink} or %{latestLink}." - read_more: "Want to read more? %{catLink} or %{latestLink}." + read_more_in_category: "Want to read more? Browse other topics in %{categoryLink} or view latest topics." + read_more: "Want to read more? Browse all categories or view latest topics." unread_indicator: "No member has read the last post of this topic yet." # This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines. - read_more_MF: "There { - UNREAD, plural, - =0 {} - one { - is # unread - } other { - are # unread + # + # 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_MF: | + { HAS_UNREAD_AND_NEW, select, + true { + { UNREAD, plural, + =0 {} + one { There is # unread } + other { There are # unread } + } + { NEW, plural, + =0 {} + one { and # new topic remaining, } + other { and # new topics remaining, } + } + } + false { + { UNREAD, plural, + =0 {} + one { There is # unread topic remaining, } + other { There are # unread topics remaining, } + } + { NEW, plural, + =0 {} + one { There is # new topic remaining, } + other { There are # new topics remaining, } + } + } + other {} + } + { HAS_CATEGORY, select, + true { or browse other topics in {categoryLink} } + false { or view latest topics } + other {} } - } { - NEW, plural, - =0 {} - one { {BOTH, select, true{and } false {is } other{}} # new topic} - 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}"