npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

i18ncsv2json

v0.9.4

Published

i18ncsv2json ============

Downloads

146

Readme

i18ncsv2json

i18n csv file to json convetor.

Expect one or more csv file with following structure:

key | en | de ------|------------|------------ about | about here | etwa hier home | homepage | Startseite

Execute following command:

i18ncsv2json tools.csv

Then will generate 2 files, one is tools.en.json:

{
  "about": "about here",
  "home": "homepage"
}

And one is tools.de.json:

{
  "about": "etwa hier",
  "home": "Startseite"
}

Working with multiple files

Multiple files can be provided as arguments.

Execute following command:

i18ncsv2json tools.csv file.csv

Will generate 4 files:

  • tools.en.json
  • tools.de.json
  • file.en.json
  • file.de.json

Wildcard can also be used in path

i18ncsv2json *.csv

Output for the same language can be merge together into a single file with the merge option.

Execute following command:

i18ncsv2json tools.csv file.csv --merge

Will generate 2 files:

  • en.json
  • de.json

Field delimiter

If you are working with English locale, the field delimiter in csv files is the , character. But for other locales (e.g. french) the ; character is used. You can adapt the csv field delimiter with the fieldDelimiter option.

Example command to use semicolon:

 i18ncsv2json directory -f ";"

Encoding

It is possible to choose the encodings (for source csv files and output json files). This can typically be usefull when managing the csv files via excel which by default saves the file in windows specific encoding and not utf-8. Default output encoding is utf8.

Example command to use read csv file with Windows encoding and output it in utf16 :

 i18ncsv2json directory -r latin1 -w utf16

Usage

i18ncsv2json [options] <files  ...>

Options:

|Short flag|Flag |Description | |----------|--------------------------|------------------------------------------------------------------------| |-h |--help |output usage information | |-V |--version |output the version number | |-p |--path [value] |output path | |-d |--delimeter [value] |delimeter between filename and lang | |-t |--transpose |transpose input csv file | |-f |--fieldDelimiter [value] |delimiter between fields | |-r |--readEncoding [value] |encoding to use to read files | |-w |--writeEncoding [value] |encoding to use to write files | |-m |--merge |merge all csv files into a single json file |