Allow single string in Zotero.Utilities.pluralize()
Zotero.Utilities.pluralize(5, 'tag') will produce 'tags' automatically
This commit is contained in:
parent
e2d7c7e999
commit
f2af77498b
|
@ -873,11 +873,15 @@ Zotero.Utilities = {
|
||||||
* For now, this is only used for debug output in English.
|
* For now, this is only used for debug output in English.
|
||||||
*
|
*
|
||||||
* @param {Integer} num
|
* @param {Integer} num
|
||||||
* @param {String[]} forms - An array of plural forms (e.g., ['object', 'objects']); currently only
|
* @param {String[]|String} forms - If an array, an array of plural forms (e.g., ['object', 'objects']);
|
||||||
* the two English forms are supported, for 1 and 0/many
|
* currently only the two English forms are supported, for 1 and 0/many. If a single string,
|
||||||
|
* 's' is added automatically for 0/many.
|
||||||
* @return {String}
|
* @return {String}
|
||||||
*/
|
*/
|
||||||
pluralize: function (num, forms) {
|
pluralize: function (num, forms) {
|
||||||
|
if (typeof forms == 'string') {
|
||||||
|
forms = [forms, forms + 's'];
|
||||||
|
}
|
||||||
return num == 1 ? forms[0] : forms[1];
|
return num == 1 ? forms[0] : forms[1];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user