gettext-volt

0.2.5 • Public • Published

gettext-volt Build Status

Extract translatable strings from Volt template strings.

It can be used stand-alone or through gmarty/gettext or perchlabs/xgettext-volt.

API

new Parser(keywordspec)

Creates a new parser. The keywordspec parameter is optional, with the default being:

{
  _: [0],
  gettext: [0],
  ngettext: [0, 1]
}

Each keyword (key) requires array of argument number(s) (value). When multiple argument numbers are specified, expressions using this keyword are treaded as single-plural.

.parse(template)

Parses the template string for Volt expressions using the keywordspec. It returns an object with this structure:

{
  msgid1: {
    line: [1, 3]
  },
  msgid2: {
    line: [2],
    plural: 'msgid_plural'
  }
}

Package Sidebar

Install

npm i gettext-volt

Weekly Downloads

983

Version

0.2.5

License

MIT

Unpacked Size

7.21 kB

Total Files

4

Last publish

Collaborators

  • dschissler