Skip to content

Commit

Permalink
Merge pull request #1685 from sgsabbage/1626-quickened-reply-plurality
Browse files Browse the repository at this point in the history
Fixes #1626 by storing the different plural phrases on the comment link
  • Loading branch information
zorkian committed Mar 25, 2016
2 parents b6d7e82 + 99351fb commit 2882695
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
16 changes: 14 additions & 2 deletions htdocs/js/jquery.quickreply.js
Expand Up @@ -123,8 +123,20 @@ jQuery(document).ready(function($) {

$readLink
.ajaxtip() // init
.ajaxtip("success", data.message) // success message
.text($readLink.text().replace(/\d+/, data.count)) // replace count
.ajaxtip("success", data.message); // success message

var commentText = '';
if ( data.count == 1 ) {
commentText = $readLink.data('sing');
}
else if ( data.count == 2 ) {
commentText = $readLink.data('dual');
}
else {
commentText = $readLink.data('plur').replace(/\d+/, data.count);
}

$readLink.text(commentText); // replace count
});

}
Expand Down
7 changes: 5 additions & 2 deletions styles/core2.s2
Expand Up @@ -6120,11 +6120,14 @@ function CommentInfo::print_readlink {
var string text_screened = get_plural_phrase($.screened_count, "text_read_comments_screened");
var string text_both = $text_visible + $*text_default_separator + $text_screened;
var string text_total = get_plural_phrase($.count, $p.view == "read" ? "text_read_comments_friends" : "text_read_comments");
var string text_sing = get_plural_phrase(1, $p.view == "read" ? "text_read_comments_friends" : "text_read_comments");
var string text_dual = get_plural_phrase(2, $p.view == "read" ? "text_read_comments_friends" : "text_read_comments");
var string text_plur = get_plural_phrase(3, $p.view == "read" ? "text_read_comments_friends" : "text_read_comments");

if ($.screened) { # show visible count and screened count
print safe """<a href="$.read_url#comments">"""+ $text_both + """</a>""";
print safe """<a href="$.read_url#comments" data-sing="$text_sing" data-dual="$text_dual" data-plur="$text_plur">"""+ $text_both + """</a>""";
} else {
print safe """<a href="$.read_url#comments">"""+ $text_total + """</a>""";
print safe """<a href="$.read_url#comments" data-sing="$text_sing" data-dual="$text_dual" data-plur="$text_plur">"""+ $text_total + """</a>""";
}
}

Expand Down
7 changes: 5 additions & 2 deletions styles/database/layout.s2
Expand Up @@ -472,18 +472,21 @@ function CommentInfo::print_readlink {
var string text_screened = get_plural_phrase($.screened_count, "text_read_comments_screened");
var string text_both = $text_visible + $*text_default_separator + $text_screened;
var string text_total = get_plural_phrase($.count, $p.view == "read" ? "text_read_comments_friends" : "text_read_comments");
var string text_sing = get_plural_phrase(1, $p.view == "read" ? "text_read_comments_friends" : "text_read_comments");
var string text_dual = get_plural_phrase(2, $p.view == "read" ? "text_read_comments_friends" : "text_read_comments");
var string text_plur = get_plural_phrase(3, $p.view == "read" ? "text_read_comments_friends" : "text_read_comments");

if ($.screened) {
if ($*entry_interaction_links == "text") {
print safe """<a href="$.read_url#comments">"""+ $text_visible + $*text_default_separator + $text_screened + """</a>""";
print safe """<a href="$.read_url#comments" data-sing="$text_sing" data-dual="$text_dual" data-plur="$text_plur">"""+ $text_visible + $*text_default_separator + $text_screened + """</a>""";
} else {
print safe """<a href="$.read_url#comments" alt="$text_both" title="$text_both">$.count <img src="$*image_comments" />"""
+ """ + $.screened_count <img src="$*image_screen" />"""
+ "</a>";
}
} else {
if ($*entry_interaction_links == "text") {
print safe """<a href="$.read_url#comments">"""+ $text_total + """</a>""";
print safe """<a href="$.read_url#comments" data-sing="$text_sing" data-dual="$text_dual" data-plur="$text_plur">"""+ $text_total + """</a>""";
} else {
print safe """<a href="$.read_url#comments" alt="$text_total" title="$text_total">$.count <img src="$*image_comments" /></a>""";
}
Expand Down

0 comments on commit 2882695

Please sign in to comment.