message format is awesome, remove 0 unread and 0 new links.

This commit is contained in:
Sam 2013-06-05 12:04:54 +10:00
parent e52e46a609
commit 93be638d93
2 changed files with 24 additions and 7 deletions

View File

@ -511,11 +511,16 @@ Discourse.TopicView = Discourse.View.extend(Discourse.Scrolling, {
var newTopics = tracking.countNew();
if (newTopics + unreadTopics > 0) {
if(category) {
return I18n.messageFormat("topic.read_more_in_category_MF", {"UNREAD": unreadTopics, "NEW": newTopics, catLink: opts.catLink})
} else {
return I18n.messageFormat("topic.read_more_MF", {"UNREAD": unreadTopics, "NEW": newTopics, latestLink: opts.latestLink})
}
var hasBoth = unreadTopics > 0 && newTopics > 0;
return I18n.messageFormat("topic.read_more_MF", {
"BOTH": hasBoth,
"UNREAD": unreadTopics,
"NEW": newTopics,
"CATEGORY": category ? true : false,
latestLink: opts.latestLink,
catLink: opts.catLink
});
}
else if (category) {
return Ember.String.i18n("topic.read_more_in_category", opts);

View File

@ -543,8 +543,20 @@ en:
read_more: "Want to read more? {{catLink}} or {{latestLink}}."
# keys ending with _MF use message format, see /spec/components/js_local_helper_spec.rb for samples
read_more_in_category_MF: "There {UNREAD, plural, one {is <a href='/unread'>1 unread</a>} other {are <a href='/unread'># unread</a>}} and {NEW, plural, one {<a href='/new'>1 new</a> topic} other {<a href='/new'># new</a> topics}} remaining, or browse other topics in {catLink}"
read_more_MF: "There {UNREAD, plural, one {is <a href='/unread'>1 unread</a>} other {are <a href='/unread'># unread</a>}} and {NEW, plural, one {<a href='/new'>1 new</a> topic} other {<a href='/new'># new</a> topics}} remaining, or {latestLink}"
read_more_MF: "There {
UNREAD, plural,
=0 {}
one {
is <a href='/unread'>1 unread</a>
} other {
are <a href='/unread'># unread</a>
}
} {
NEW, plural,
=0 {}
one { {BOTH, select, true{and } false {is } other{}} <a href='/new'>1 new</a> topic}
other { {BOTH, select, true{and } false {are } other{}} <a href='/new'># new</a> topics}
} remaining, or {CATEGORY, select, true {browse other topics in {catLink}} false {{latestLink}} other {}} "
browse_all_categories: Browse all categories