Helpers to provide pluralisation/inflection choices
var Handlebars = require("handlebars");
var Choice = require("handlebars.choice");
Choice.registerHelpers(Handlebars);
Returns
Choice instance
- Type
- object
Members
(inner) getPluralKeywordOptions
Returns a keyword reflecting variable’s amount
Properties:
Name | Type | Default | Description |
---|---|---|---|
name |
string | getPluralKeyword | |
fn |
function | getPluralKeyword |
Methods
(static) locale(locopt) → {string}
Get or set default locale used by Choice
If called without loc parameter, returns locale
If called with loc parameter, sets locale
Parameters
Name | Type | Attributes | Description |
---|---|---|---|
loc |
string |
<optional> |
Locale to change to |
Returns
Choice’s locale
- Type
- string
(static) registerHelpers(hbars)
Parameters
Name | Type | Description |
---|---|---|
hbars |
object | Handlebars instance |
(inner) getBoolean(bool) → {string}
Returns a keyword whether variable was true or not
Parameters
Name | Type | Description |
---|---|---|
bool |
boolean | Variable to be converted to keyword |
Returns
keyword (true|false)
- Type
- string
(inner) getPluralKeyword(num) → {string}
Default method to return pluralisation keyword
Parameters
Name | Type | Description |
---|---|---|
num |
number | Variable to be converted to keyword |
Returns
keyword (zero|one|other)
- Type
- string
(inner) registerChoice(options)
Register a function to use for returning keywords
Parameters
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
Properties
|
(inner) unregisterChoice(name, loc)
Remove a choice bundle from register
Parameters
Name | Type | Description |
---|---|---|
name |
string | Name of choice bundle |
loc |
string | Bundle’s locale |