Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fima-taf/nolybab-js
A CLI based tool for converting i18n to csv and csv to i18n files.
https://github.com/fima-taf/nolybab-js
Last synced: about 2 months ago
JSON representation
A CLI based tool for converting i18n to csv and csv to i18n files.
- Host: GitHub
- URL: https://github.com/fima-taf/nolybab-js
- Owner: fima-taf
- License: mit
- Created: 2022-05-05T14:41:50.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-11T18:07:51.000Z (11 months ago)
- Last Synced: 2024-09-19T11:19:22.978Z (4 months ago)
- Language: TypeScript
- Homepage:
- Size: 153 KB
- Stars: 7
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-opensource-israel - Nolybab-js - A CLI based tool for converting i18n to csv and csv to i18n files. ![GitHub last commit](https://img.shields.io/github/last-commit/fima-taf/nolybab-js?style=flat-square) ![GitHub top language](https://img.shields.io/github/languages/top/fima-taf/nolybab-js?style=flat-square) ![GitHub stars](https://img.shields.io/github/stars/fima-taf/nolybab-js?style=flat-square) (Projects by main language / typescript)
README
# Nolybab JS
A CLI based tool for converting i18n to csv and csv to i18n files.
This tool allow you to quickly convert all your i18n (json) files in your project into a csv file and vice versa.## Table of Contents
* [Install](#install)
* [Usage](#usage)
* [Examples](#examples)
* [License](#license)## Install
```
npm install nolybab-js
```## Usage
```
npx nolybab -a to-csv
npx nolybab -a to-i18n
```
```
Options:
-a, --action The action to be executed. to-csv | to-i18n
[string] [required]
-m, --i18n-main-file-name The name of the main i18n file
[string] [default: "en"]
-i, --i18n-files-path The path to the i18n files
[string] [default: "src/languages"]
-c, --csv-delimiter The csv delimiter [string] [default: ","]
-n, --csv-file-name The name of the csv translations file
[string] [default: "nolybab"]
-p, --csv-file-path The path to the csv translations file
[string] [default: "src/languages"]
```## Examples
Running the command `npx nolybab -a to-csv` will convert the following i18n json files:Click to see
```js
export const en = {
hello: 'Hello',
yes: 'Yes',
no: 'No',
login: {
title: 'Login',
message: 'Please login'
},
home: {
description: 'Welcome to Nolybab',
header: {
title: 'Nolybab'
},
footer: {
credit: '2022 Nolybab'
},
body: {
about: {
title: 'About'
},
contact_us: 'Contact us'
}
}
}export const fr = {
hello: 'Bonjour',
yes: 'Oui',
no: 'Non',
login: {
title: 'Connexion',
message: 'Veuillez vous connecter'
},
home: {
description: 'Bienvenue sur Nolybab',
header: {
title: 'Nolybab'
},
footer: {
credit: '2022 Nolybab'
},
body: {
about: {
title: 'Sur'
},
contact_us: 'Nous contacter'
}
}
}export const es = {
hello: 'Hola',
yes: 'Sí',
no: 'No',
login: {
title: 'Acceso',
message: 'Por favor Iniciar sesión'
},
home: {
description: 'Bienvenido a nolybab',
header: {
title: 'Nolybab'
},
footer: {
credit: '2022 Nolybab'
},
body: {
about: {
title: 'Acerca de'
},
contact_us: 'Contacta con nosotros'
}
}
}
```into the following csv file:
Click to see
```
,en,es,fr
hello,Hello,Hola,Bonjour
yes,Yes,Sí,Oui
no,No,No,Non
login.title,Login,Acceso,Connexion
login.message,Please login,Por favor Iniciar sesión,Veuillez vous connecter
home.description,Welcome to Nolybab,Bienvenido a nolybab,Bienvenue sur Nolybab
home.header.title,Nolybab,Nolybab,Nolybab
home.footer.credit,2022 Nolybab,2022 Nolybab,2022 Nolybab
home.body.about.title,About,Acerca de,Sur
home.body.contact_us,Contact us,Contacta con nosotros,Nous contacter
```![CSV file](https://user-images.githubusercontent.com/18335346/167492345-ee742731-9f66-4a8f-9f79-a6b37115fc91.png)
Running the command `npx nolybab -a to-i18n` will convert the csv back into the i18n json files above
## License
[MIT](LICENSE)