-
-
Save danbernier/5950117 to your computer and use it in GitHub Desktop.
This is more what I was after - this way, ratingText is created once, AND it's private.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var getRatingText = (function() { | |
var ratingText = { | |
singular: { | |
"Closed": L("1_person_voted_to_get_this_issue_fixed", "1 person voted to get this issue fixed"), | |
"Archived": L("1_person_voted_to_get_this_issue_fixed", "1 person voted to get this issue fixed"), | |
default: L("1_person_wants_this_fixed", "1 person wants this fixed") | |
}, | |
plural: { | |
"Closed": L("people_voted_to_get_this_issue_fixed", "%s people voted to get this issue fixed"), | |
"Archived": L("people_voted_to_get_this_issue_fixed", "%s people voted to get this issue fixed"), | |
default: L("people_want_this_fixed", "%s people want this fixed") | |
} | |
}; | |
return function(rating, status) { | |
if (Number(rating) === 1) { | |
return ratingText.singular[status] || ratingText.singular.default; | |
} | |
else { | |
return String.format( | |
ratingText.plural[status] || ratingText.plural.default, | |
rating | |
); | |
} | |
} | |
)(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment