npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

simpleen

v0.6.3

Published

Translate i18n locale files with simpleen translation

Downloads

158

Readme

Simpleen

Translate i18n locale files with Simpleen

oclif Version Downloads/week License

Usage

The Simpleen CLI Tool for direct project integrations. Integrate machine translation into your development workflow to automatically handle the translation of i18n locales.

Currently the CLI is compatible with JSON-based i18n libraries like:

  • Format.JS (react-intl)
  • i18next
  • LinguiJS
  • ngx-translate
  • Transloco
  • Polyglot.js

This can also be combined with the i18n extractor of your i18n library which leads to continuous translations during the development workflow.

Installation

You can install the CLI globally

$ yarn global add simpleen
$ simpleen init
$ simpleen translate

or locally:

$ yarn add -D simpleen
$ yarn run simpleen init
$ yarn run simpleen lock
$ yarn run simpleen translate

To use the CLI Tool signup on simpleen.io and create an authentication key. Then you can run simpleen init and answer the prompted configuration questions. In the last step you will be asked for your authentication key.

As a next step you can fix/lock the current translations with simpleen lock. The locked translations are not getting translated by machine translation.

Commands

simpleen init

Simpleen init let's you configure your i18n project. By default the configuration will be saved at ./simpleen.config.json. Use the config option to change the path and filename.


USAGE
  $ simpleen init

OPTIONS
  --config=config  [default: ./simpleen.config.json] Defines where the config file will be created

EXAMPLE
  $ simpleen init
  // Answer project questions
  Configuration ./simpleen.config.json saved

For the input_path you can use a glob pattern to find multiple translation files if needed. For example ./src/**/en.json or ./src/en/*.json. The output_path can be constructed with additional variables that are replaced as followed:

| Variable | Explanation | |:--------------|:---------------------------------------------------------------------------------------| | $locale | Lowercase locale, i. e. fr for French | | $LOCALE | Uppercase locale, i. e. FR for French | | $FILE | Filename of matched translation file, i. e. ./locale/store/product.json => product | | $FOLDER | Folder name of matched translation file, i. e. ./locale/store/product.json => store | | $PATH | Path to matched translation file, i. e. ./locale/store/product.json => ./locale/store/ | | $EXTENSION | Extension of matched translation file, i. e. ./locale/store/product.json => json |

The created configuration file could look like this:

{
  "source_language": "EN",
  "target_languages": ["DE", "PT-BR"],
  "interpolation": "i18n",
  "input_path": "./public/locales/en/*.json",
  "output_path": "./public/locales/$locale/$FILE.json",
  "auth_key": "AUTHENTICATION_KEY"
}

Add glossary manually

Add your glossaries in the configuration file (simpleen.config.json) manually. Use one glossary per target language:

{
  "source_language": "EN",
  "target_languages": ["DE", "PT-BR"],
  "interpolation": "i18n",
  "input_path": "./public/locales/en/*.json",
  "output_path": "./public/locales/$locale/$FILE.json",
  "auth_key": "AUTHENTICATION_KEY",
  "glossary": {
    "DE": 100,
    "PT-BR": 103
  }
}

You don't need to provide a glossary for each target language if you don't need one. Just skip it

{
  "glossary": {
    "DE": 100
  }
}

[Deprecated - use simpleen upload] simpleen lock

Locks the current translation results. Locked translations will not be overwritten by simpleen translate. Lock the translations after manual changes and put it under version control, otherwise they are overwritten with the next run of simpleen translate. Use this command also after moving/renaming your translation files.

USAGE
  $ simpleen lock

OPTIONS
  --config=config      [default: ./simpleen.config.json] Defines where the config is located

simpleen translate

Translate the project corresponding to the configuration and in compliance with the lock file.

USAGE
  $ simpleen translate

OPTIONS
  --config=config      [default: ./simpleen.config.json] Defines where you config file is located

simpleen upload

Saves the current translation results at simpleen.io. These are used for subsequent translations and are not counted to your quota. If you have already some parts translated, use this command before simpleen translate to save your progress. Also if you have adapted your target files, use this command to sync your changes.

USAGE
  $ simpleen upload

OPTIONS
  --config=config      [default: ./simpleen.config.json] Defines where the config is located

simpleen usage

Shows the current quota of your account. A segment is one translatable value in your JSON file.

USAGE
  $ simpleen usage

OPTIONS
  --config=config      [default: ./simpleen.config.json] Defines where the config is located

simpleen help [COMMAND]

Display help for Simpleen.

USAGE
  $ simpleen help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

Version Control

As a precaution please make sure that the project is under version control before running simpleen translate. Feel free to get in touch with us for feedback, discussions, improvements or tweet and blog about Simpleen.