You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

babel-plugin-ltag

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-ltag

a babel-pluging to transform l-template tags.

Source
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

ltag

ltag is a babel-pluging for localization, transforms templates tagged l.

Usage

  • Install babel as global, and ltag plugin as a development dependency:
npm install -g babel-cli
npm install --save-dev babel-plugin-ltag
  • Create a .babelrc file:
{
  "plugins": [
    ["babel-plugin-ltag", {
      "pot": "file.pot",  // pristine po file, all l-tagged templates inside source are written here
      "po": "file.po"    // actual po file to use for translation
    }]
  ]
}
  • Inside your application use ltag:
console.log(l`Hi dear, ${username}`);
console.log(l('context')`Another message`);
  • Run babel over your code:
babel test.js

.pot file will be generated, and with subsequent executions it will be updated.

msgid ""
msgstr "Content-Type: text/plain;utf-8\n"

#: test.js:1
#, kde-format
msgid "Hi dear, %0"
msgstr ""

#: test.js:2
msgctxt "context"
msgid "Another message"
msgstr ""
  • Copy generated .pot file to a .po file and translate strings inside it. Run babel again and you'll have transformed code.

TODO

  • Plural Forms
  • TRANSLATOR comments extraction

Keywords

babel-plugin

FAQs

Package last updated on 23 Apr 2017

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