All Projects → lukasgeiter → gettext-extractor

lukasgeiter / gettext-extractor

Licence: MIT license
A flexible and powerful Gettext message extractor with support for JavaScript, TypeScript, JSX and HTML.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to gettext-extractor

Node Gettext
A JavaScript implementation of gettext, a localization framework.
Stars: ✭ 175 (+113.41%)
Mutual labels:  i18n, translation, l10n, gettext
Weblate
Web based localization tool with tight version control integration.
Stars: ✭ 2,719 (+3215.85%)
Mutual labels:  i18n, translation, l10n, gettext
Glotpress Wp
🌍 🌎 🌏 GlotPress is a WordPress plugin to let you set up your own collaborative, web-based software translation tool.
Stars: ✭ 205 (+150%)
Mutual labels:  i18n, translation, l10n, gettext
msgtools
Tools for Developing Diagnostic Messages
Stars: ✭ 18 (-78.05%)
Mutual labels:  i18n, l10n, po-files, gettext
Gotext
Go (Golang) GNU gettext utilities package
Stars: ✭ 292 (+256.1%)
Mutual labels:  i18n, translation, l10n, gettext
Gettext Go
🆎 GNU gettext for Go (Imported By Kubernetes)
Stars: ✭ 66 (-19.51%)
Mutual labels:  i18n, translation, gettext
Pootle
Online translation tool
Stars: ✭ 1,346 (+1541.46%)
Mutual labels:  i18n, translation, l10n
Dom I18n
Provides a very basic HTML multilingual support using JavaScript
Stars: ✭ 125 (+52.44%)
Mutual labels:  i18n, translation, l10n
Punic
PHP translation and localization made easy!
Stars: ✭ 133 (+62.2%)
Mutual labels:  i18n, translation, l10n
Es2015 I18n Tag
ES2015 template literal tag for i18n and l10n (translation and internationalization)
Stars: ✭ 171 (+108.54%)
Mutual labels:  i18n, translation, l10n
Ngettext
A cross-platform .NET implementation of the GNU/Gettext library.
Stars: ✭ 172 (+109.76%)
Mutual labels:  i18n, l10n, gettext
Tempura
Pure Clojure/Script i18n translations library
Stars: ✭ 211 (+157.32%)
Mutual labels:  i18n, translation, gettext
stone.js
gettext-like client-side Javascript Internationalization Library
Stars: ✭ 20 (-75.61%)
Mutual labels:  i18n, l10n, gettext
Webfactoryicutranslationbundle
Enables ICU message formatting for translations in Symfony applications.
Stars: ✭ 27 (-67.07%)
Mutual labels:  i18n, translation, l10n
Pseudo Localization
Dynamic pseudo-localization in the browser and nodejs
Stars: ✭ 109 (+32.93%)
Mutual labels:  i18n, translation, l10n
Django Rosetta
Rosetta is a Django application that eases the translation process of your Django projects
Stars: ✭ 806 (+882.93%)
Mutual labels:  i18n, translation, gettext
Translation
The Translation component provides tools to internationalize your application.
Stars: ✭ 6,196 (+7456.1%)
Mutual labels:  i18n, translation, l10n
Gettext
PHP library to collect and manipulate gettext (.po, .mo, .php, .json, etc)
Stars: ✭ 578 (+604.88%)
Mutual labels:  i18n, translation, gettext
Fluent.js
JavaScript implementation of Project Fluent
Stars: ✭ 622 (+658.54%)
Mutual labels:  i18n, translation, l10n
i18n
internationalize projects to Arabic
Stars: ✭ 67 (-18.29%)
Mutual labels:  i18n, translation, l10n

Gettext Extractor Tests Status

A flexible and powerful Gettext message extractor with support for JavaScript, TypeScript, JSX and HTML

It works by running your files through a parser and then uses the AST (Abstract Syntax Tree) to find and extract translatable strings from your source code. All extracted strings can then be saved as .pot file to act as template for translation files.

Unlike many of the alternatives, this library is highly configurable and is designed to work with most existing setups.

For the full documentation check out the Github Wiki.


Installation

Note: This package requires Node.js version 6 or higher.

Yarn

yarn add gettext-extractor

NPM

npm install gettext-extractor

Getting Started

Let's start with a code example:

const { GettextExtractor, JsExtractors, HtmlExtractors } = require('gettext-extractor');

let extractor = new GettextExtractor();

extractor
    .createJsParser([
        JsExtractors.callExpression('getText', {
            arguments: {
                text: 0,
                context: 1
            }
        }),
        JsExtractors.callExpression('getPlural', {
            arguments: {
                text: 1,
                textPlural: 2,
                context: 3
            }
        })
    ])
    .parseFilesGlob('./src/**/*.@(ts|js|tsx|jsx)');

extractor
    .createHtmlParser([
        HtmlExtractors.elementContent('translate, [translate]')
    ])
    .parseFilesGlob('./src/**/*.html');

extractor.savePotFile('./messages.pot');

extractor.printStats();

A detailed explanation of this code example and much more can be found in the Github Wiki.


Contributing

From reporting a bug to submitting a pull request: every contribution is appreciated and welcome. Report bugs, ask questions and request features using Github issues. If you want to contribute to the code of this project, please read the Contribution Guidelines.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].