An open API service indexing awesome lists of open source software.

https://github.com/win-le/script-language

CLI generate multiple language
https://github.com/win-le/script-language

cli language multiple-language script

Last synced: 6 months ago
JSON representation

CLI generate multiple language

Awesome Lists containing this project

README

          

# script-language

This is CLI command.

The `script-language` 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
```

## CLI command

| Flag | Type | Description |
| ------------ | ------ | ---------------------------------------- |
| **--outDir** | string | Path of folder consist will be generated |

## File language.config.json

| Properties | Type | Description | Default |
| ---------------- | ------------------ | ----------------------------------------------- | ------------------------- |
| **excludes** | array | Folder will be ignored | ["node_modules"] |
| **includes** | array | Folder will be run | ["src"] |
| **match** | string | File match | \^.\*.(js\|ts\|jsx\|tsx)$ |
| **nameFunction** | string \| string[] | Name of function contain text will be generated | "\_t" |
| **outDir** | string | Path of folder consist will be generated | "./language" |
| **language** | array | List language | ["vi-VI", "en-EN"] |

## Example

```
...

{ _t("Sessions is expired.") }

...
{_t("Sign in")}

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

...
{_t("Sent")}
```


`language/vi.json`

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

`language/en.json`

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