JSPM

gettext-ejs

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2255
  • Score
    100M100P100Q111255F
  • License MIT

Extract translatable strings from EJS templates

Package Exports

  • gettext-ejs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gettext-ejs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

gettext-ejs

Extract translatable strings from EJS templates.

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

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 Swig expressions using the keywordspec. It returns an object with this structure:

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