Code Monkey home page Code Monkey logo

pluto-i18n's Introduction

pluto-i18n

This package is a tool to ease the way of adding texts to language's .json

Install

npm i -D pluto-i18n

Add this script to your package.json

"pi18n": "node node_modules/pluto-i18n/index.js"

Then create a .json file for every language you want to add. Each one of them needs to have an object, doesn't matter if it's empty. You can locate these files wherever you prefer.

Usage

By CLI

npm run pi18n {action} {language_json_path} {key} {text}

By JSON

First you have to create an "addText.json" at the root folder, it has to look like this

[{ "path": "language_json_path", "key": "key", "text": "text" }]

Then you have to run npm run pi18n json

Actions

Action Description
add Add text by CLI, up next you have to put the language json path, the key and the text
json Add text by reading the addText.json
remove Remove a key. You don't need to put the text, only the key and the language_json_path

Optional path shortener

You can put an addTextPaths.json in the root folder to abbreviate the paths, this is useful when using the CLI, as you don't have to put the full path

{
    "es": "src/lib/i18n/languages/spanish.json",
    "en": "src/lib/i18n/languages/english.json",
    "pr": "src/lib/i18n/languages/portuguese.json"
}

Then you can do:

npm run pi18n add es hello hola

or in the addText.json

      { "path": "es", "key": "hello", "text": "hola"
      { "path": "en", "key": "hello", "text": "hello" }
   ]

pluto-i18n's People

Contributors

ja-boop avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.