1.0.2 • Published 2 years ago

script-language v1.0.2

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

script-language

This is CLI command. It will generate text which around by any function to object.

Install

With npm

  npm install -g script-language

With yarn

  yarn global add script-language

Usage

Run script in your code folder

  script-language

Config

PropertiesTypeDescriptionDefault
excludesarrayFolder will be ignored"node_modules"
includesarrayFolder will be run"src"
matchstringFile match\^.*.(js|ts|jsx|tsx)$
nameFunctionstringName of function contain text will be generated"_t"
pathJsonstringPath and name of file will be generated"./language.json"
languagearrayList language"vi-VI", "en-EN"

Example

  ...
  <div>{ _t("Sessions is expired.") }</div>

  ...
  <a>{_t("Sign in")}</a>  


  ...
  console.log(_t("You can reset password"))

  ...
  <button>{_t("Sent")}</button>

language.json

  {
    "Sessions is expired.": {
        "vi": "Sessions is expired.",
        "en": "Sessions is expired."
    },
    "Sign in": {
        "vi": "Sign in",
        "en": "Sign in"
    },
    "You can reset password": {
        "vi": "You can reset password",
        "en": "You can reset password"
    },
    "Send": {
        "vi": "Send",
        "en": "Send"
    }
  }