mirror of
https://github.com/discourse/discourse.git
synced 2024-12-02 09:03:45 +08:00
REFACTOR: Update Message Format string to simplify translation
This commit is contained in:
parent
584abbda54
commit
d059c64485
|
@ -80,11 +80,6 @@ export default Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
_topicBrowseMoreMessage(topic) {
|
_topicBrowseMoreMessage(topic) {
|
||||||
const opts = {
|
|
||||||
latestLink: `<a href="${getURL("/latest")}">${I18n.t(
|
|
||||||
"topic.view_latest_topics"
|
|
||||||
)}</a>`,
|
|
||||||
};
|
|
||||||
let category = topic.get("category");
|
let category = topic.get("category");
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
@ -94,17 +89,6 @@ export default Component.extend({
|
||||||
category = null;
|
category = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (category) {
|
|
||||||
opts.catLink = categoryBadgeHTML(category);
|
|
||||||
} else {
|
|
||||||
opts.catLink =
|
|
||||||
'<a href="' +
|
|
||||||
getURL("/categories") +
|
|
||||||
'">' +
|
|
||||||
I18n.t("topic.browse_all_categories") +
|
|
||||||
"</a>";
|
|
||||||
}
|
|
||||||
|
|
||||||
let unreadTopics = 0;
|
let unreadTopics = 0;
|
||||||
let newTopics = 0;
|
let newTopics = 0;
|
||||||
|
|
||||||
|
@ -114,21 +98,24 @@ export default Component.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newTopics + unreadTopics > 0) {
|
if (newTopics + unreadTopics > 0) {
|
||||||
const hasBoth = unreadTopics > 0 && newTopics > 0;
|
|
||||||
|
|
||||||
return I18n.messageFormat("topic.read_more_MF", {
|
return I18n.messageFormat("topic.read_more_MF", {
|
||||||
BOTH: hasBoth,
|
HAS_UNREAD_AND_NEW: unreadTopics > 0 && newTopics > 0,
|
||||||
UNREAD: unreadTopics,
|
UNREAD: unreadTopics,
|
||||||
NEW: newTopics,
|
NEW: newTopics,
|
||||||
CATEGORY: category ? true : false,
|
HAS_CATEGORY: category ? true : false,
|
||||||
latestLink: opts.latestLink,
|
categoryLink: category ? categoryBadgeHTML(category) : null,
|
||||||
catLink: opts.catLink,
|
|
||||||
basePath: getURL(""),
|
basePath: getURL(""),
|
||||||
});
|
});
|
||||||
} else if (category) {
|
} 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 {
|
} else {
|
||||||
return I18n.t("topic.read_more", opts);
|
return I18n.t("topic.read_more", {
|
||||||
|
categoryLink: getURL("/categories"),
|
||||||
|
latestLink: getURL("/latest"),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -2863,25 +2863,47 @@ en:
|
||||||
show_links: "show links within this topic"
|
show_links: "show links within this topic"
|
||||||
collapse_details: "collapse topic details"
|
collapse_details: "collapse topic details"
|
||||||
expand_details: "expand topic details"
|
expand_details: "expand topic details"
|
||||||
read_more_in_category: "Want to read more? Browse other topics in %{catLink} or %{latestLink}."
|
read_more_in_category: "Want to read more? Browse other topics in %{categoryLink} or <a href='%{latestLink}'>view latest topics</a>."
|
||||||
read_more: "Want to read more? %{catLink} or %{latestLink}."
|
read_more: "Want to read more? <a href='%{categoryLink}'>Browse all categories</a> or <a href='%{latestLink}'>view latest topics</a>."
|
||||||
unread_indicator: "No member has read the last post of this topic yet."
|
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.
|
# This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines.
|
||||||
read_more_MF: "There {
|
#
|
||||||
UNREAD, plural,
|
# 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 {}
|
=0 {}
|
||||||
one {
|
one { There is <a href="{basePath}/unread"># unread</a> }
|
||||||
is <a href='{basePath}/unread'># unread</a>
|
other { There are <a href="{basePath}/unread"># unread</a> }
|
||||||
} other {
|
|
||||||
are <a href='{basePath}/unread'># unread</a>
|
|
||||||
}
|
}
|
||||||
} {
|
{ NEW, plural,
|
||||||
NEW, plural,
|
|
||||||
=0 {}
|
=0 {}
|
||||||
one { {BOTH, select, true{and } false {is } other{}} <a href='{basePath}/new'># new</a> topic}
|
one { and <a href="{basePath}/new"># new</a> topic remaining, }
|
||||||
other { {BOTH, select, true{and } false {are } other{}} <a href='{basePath}/new'># new</a> topics}
|
other { and <a href="{basePath}/new"># new</a> topics remaining, }
|
||||||
} remaining, or {CATEGORY, select, true {browse other topics in {catLink}} false {{latestLink}} other {}}"
|
}
|
||||||
|
}
|
||||||
|
false {
|
||||||
|
{ UNREAD, plural,
|
||||||
|
=0 {}
|
||||||
|
one { There is <a href="{basePath}/unread"># unread</a> topic remaining, }
|
||||||
|
other { There are <a href="{basePath}/unread"># unread</a> topics remaining, }
|
||||||
|
}
|
||||||
|
{ NEW, plural,
|
||||||
|
=0 {}
|
||||||
|
one { There is <a href="{basePath}/new"># new</a> topic remaining, }
|
||||||
|
other { There are <a href="{basePath}/new"># new</a> topics remaining, }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
other {}
|
||||||
|
}
|
||||||
|
{ HAS_CATEGORY, select,
|
||||||
|
true { or browse other topics in {categoryLink} }
|
||||||
|
false { or <a href="{basePath}/latest">view latest topics</a> }
|
||||||
|
other {}
|
||||||
|
}
|
||||||
|
|
||||||
# This string uses the ICU Message Format. See https://meta.discourse.org/t/7035 for translation guidelines.
|
# 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}"
|
bumped_at_title_MF: "{FIRST_POST}: {CREATED_AT}\n{LAST_POST}: {BUMPED_AT}"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user