1.0.2 • Published 2 years ago

handlebars-i18next-parser v1.0.2

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
2 years ago

handlebars-i18next-parser

Parser/lexer for the combination of handlebars-i18next and i18next-parser.

If you are using handlebars-i18next to insert translation strings into your Handlebars templates, then this package will enable you to extract the keys (and default values) into JSON files for your translators.

Quickstart

Installation:

npm install --save-dev handlebars-i18next-parser
yarn add -D handlebars-i18next-parser

Configuration for i18next-parser (by default this assumes you use i18n as the name for the helper; see below on how to override):

import HbsI18nLexer from 'handlebars-i18next-parser';

{
    lexers: {
        hbs: [HbsI18nLexer],
        handlebars: [HbsI18nLexer],
    }
}

Finally, run i18next-parser as documented.

Using alternative helper/function names

handlebars-i18next lets you override the helper name. If you use this feature, for example to use the name t instead, you can notify the lexer by changing the i18next-parser lexers configuration as follows:

{
    lexers: {
        hbs: [{
            lexer: HbsI18nLexer,
            functions: ['t'],
        }],
    }
}

Made by

Digital Humanities Lab

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago