Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gettext-handlebars

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gettext-handlebars

Extract translatable strings from Handlebars templates

  • 0.4.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

gettext-handlebars build status

Extract translatable strings from Handlebars template strings.

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:

{
  gettext: ['msgid'],
  _: ['msgid'],

  ngettext: ['msgid', 'msgid_plural'],
  n_: ['msgid', 'msgid_plural'],

  pgettext: ['msgctxt', 'msgid'],
  p_: ['msgctxt', 'msgid'],

  npgettext: ['msgctxt', 'msgid', 'msgid_plural'],
  np_: ['msgctxt', 'msgid', 'msgid_plural']
}

Each keyword (key) requires array of strings indicating the order of expected PO fields. For example npgettext: ['msgctxt', 'msgid', 'msgid_plural'] indicates that the npgettext handlebars helper takes arguments of form {{npgettext "context" "string" "plural" ...}}

.parse(template)

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

{
  msgid1: {
    line: [1, 3]
  },
  msgid2: {
    line: [2],
    plural: 'msgid_plural'
  },
  context\u0004msgid2: {
    line: [4]
  }
}

Keywords

FAQs

Package last updated on 26 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc