@open-xchange/i18next-po-parser

0.0.3 • Public • Published

@open-xchange/i18next-po-parser

A small utility that scans source code for calls of the i18next translation function t() and the react-i18next component <Trans>, extracts all translation keys, and generates the contents for a PO/POT file (GetText translation catalog) containing all extracted strings.

Essentially, this utility glues together the packages i18next-parser (parses source code for t function calls etc.), and gettext-converter (generates the PO file contents from i18next catalog data).

Installation

npm install @open-xchange/i18next-po-parser
# or
yarn add @open-xchange/i18next-po-parser

Usage

API

import parse from "@open-xchange/i18next-po-parser";

// returns a `Map<string, string>` (namespaces to PO catalog data)
const map = await parse({
  project: "Example App",
  files: "src/**/*.{js,ts,jsx,tsx}",
});

CLI

npm run i18next-po-parser --project "Example App" --files "src/**/*.{js,ts,jsx,tsx}" --output '$NAMESPACE.pot'
# or
yarn i18next-po-parser --project "Example App" --files "src/**/*.{js,ts,jsx,tsx}" --output '$NAMESPACE.pot'

Readme

Keywords

none

Package Sidebar

Install

npm i @open-xchange/i18next-po-parser

Weekly Downloads

92

Version

0.0.3

License

MIT

Unpacked Size

10.8 kB

Total Files

7

Last publish

Collaborators

  • moritz.bach
  • johnyb
  • davidbauer
  • solygen
  • daniel.rentz
  • alexquast
  • d.haus
  • maik.schaefer
  • anne.matthes
  • andree
  • bjoern.koester
  • tran-dong.tran
  • ox-kaci