Code Monkey home page Code Monkey logo

nolybab-js's Introduction

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

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
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

Running the command npx nolybab -a to-i18n will convert the csv back into the i18n json files above

License

MIT

nolybab-js's People

Contributors

fima-taf 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.