Skip to content

Gettext message extractor with support for JavaScript, TypeScript, JSX written in Rust.

License

Notifications You must be signed in to change notification settings

ramon-villain/gettext-extractors

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gettext-Extractor.rs 🦀

Introduction

This is a work-in-progress Gettext message extractor written in Rust, with support for JavaScript, TypeScript, and JSX files. It is inspired by lukasgeiter/gettext-extractor.

Usage

You can use gettext-extractor by either providing a configuration file or piping the content directly to the program.

Using a Configuration File

Provide a configuration file as an argument:

gettext-extractor -c /path/to/config.json

Here's an example config.json:

Click to see the example config.json
{
  "functions": {
    "gettext": {
      "text": 0
    },
    "ngettext": {
      "text": 0,
      "plural": 1
    },
    "pgettext": {
      "text": 1,
      "context": 0
    },
    "npgettext": {
      "context": 0,
      "text": 1,
      "plural": 2
    }
  },
  "exclude": [
    "!{node_modules}",
    "!*{test}.{tsx,ts}"
  ],
  "include": [
    "src/**/*.{ts,tsx}"
  ],
  "base": "/path/to/your-project"
}

Piping Content to the Program

Alternatively, you can pipe the content to the program:

./gettext-extractor -b /path/to/your-project/ -e "\!{node_modules}/" -e '!*{test,stories}.{tsx,ts}' -i "src/**/*.{ts,tsx}"

Feel free to use whichever method suits your needs best for extracting Gettext messages from your codebase.

Please note that this project is still a work in progress, and feedback or contributions are highly appreciated!

About

Gettext message extractor with support for JavaScript, TypeScript, JSX written in Rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages