Module larynx

Convenience object providing a collection of Handlebars helper objects and some of their methods

var Larynx = require("larynx");
Returns

Larynx instance

Type
object
Source:

Members

(static) Choice :object

Alias to handlebars.choice

Type:
  • object
Source:

(static) El :object

Alias to handlebars.el

Type:
  • object
Source:

(static) ElForm :object

ALias to handlebars.el.form

Type:
  • object
Source:

(static) Filter :object

Alias to handlebars.filter

Type:
  • object
Source:

(static) Moment :object

Alias to handlebars.moment

Type:
  • object
Source:

(static) Numeral :object

Alias to handlebars.numeral

Type:
  • object
Source:

(static) Phrase :object

Alias to handlebars.phrase

Type:
  • object
Source:

Methods

(static) addLanguage(lang, phrases)

Add phrases to individual language

Clears any previously cached strings or templates for language

Parameters
Name Type Description
lang string

Language to add to

phrases object

Phrases object for the language

Source:

(static) addLanguages(languagesopt)

Add keys to existing languages object

Clears any previously cached strings or templates for languages passed

Parameters
Name Type Attributes Description
languages object <optional>

Object of language phrases

Source:

(static) locale(locopt) → {string}

Get or set default locale used by Larynx

If called without loc parameter, returns locale

If called with loc parameter, sets locale for Larynx and

  • Larynx.Phrase
  • Larynx.Choice
  • Larynx.Filter
Parameters
Name Type Attributes Description
loc string <optional>
Source:
Returns

Larynx’s locale

Type
string

(static) registerFilter(name, fn)

Add filter to Filter

Parameters
Name Type Description
name string

Name of filter

fn function

Filter function

Source:

(static) registerHelpers(hbars)

Register Larynx helpers with Handlebars

Parameters
Name Type Description
hbars object

Handlebars instance

Source:

(static) setLanguage(lang, phrases)

Set language individually

Clears any previously cached strings or templates for language

Parameters
Name Type Description
lang string

Language to be set

phrases object

Phrases object for the language

Source:

(static) setLanguages(languagesopt, optionsopt)

Set languages object without which Phrase cannot work

Clears any previously set languages

Parameters
Name Type Attributes Default Description
languages object <optional>

Object of language phrases

options object <optional>
options.​localefallback boolean <optional>
false

Whether default language should provide missing values for other languages

options.​penddelimiter string <optional>
.

Delimiter to use when appending or prepending keys

Source:

(static) unregisterFilter(name)

Remove filter from Filter

Parameters
Name Type Description
name string

Name of filter

Source: