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

i18n-generator

v0.5.1

Published

i18n json files generator for node, web browser and command line

Downloads

525

Readme

i18n-generator

Build Status Coverage Status Dependency Status devDependency Status

i18n json files generator for node, web browser and command line.

i18n Online Demo Tools / Edit Demo CSV File

screen shot 2017-09-25 at 11 34 33 pm

Getting Started

node.js Install the module with: npm install i18n-generator

const i18nGenerator = require('i18n-generator');

const inputFile  = 'input.txt';
const outputPath = 'output';

i18nGenerator(inputFile, outputPath);

// js-beautify your json
i18nGenerator(inputFile, outputPath, true);
// or given js-beautify options
i18nGenerator(inputFile, outputPath, { indent_size: 2 });
// settings split variable (default as |)
i18nGenerator(inputFile,outputPath, options, 'csv');

// options => https://github.com/beautify-web/js-beautify#options
// splitter support
// | => pipe (default)
// , => csv
// \t => tsv

// get output data api
// input can be file (.txt) or string (data)
i18nGenerator.get(input, 'csv', (err, data) => {
    console.log(data);
    // => output i18n data
});

// or you can
i18nGenerator.get(input, (err, data) => {
	console.log(data);
});

browser

<script src="i18n-generator.js"></script>
const { i18n } = window;
i18n(inputData, 'csv', (err, data) => {
    console.log(data);
    // => output i18n data
});

// or easily
i18n(inputData, (err, data) => {
	console.log(data);
	// => split default pipe |
});

cli

$ i18n input.txt output

# generate from csv or tsv
$ i18n input.csv output

# watch file
$ i18n input.txt output --watch

Workflow

input file

i18n=>, en, zh_TW, de, my
you, you, 你, Du, kamu
I, I, 我, ich, Saya
love, love, 喜歡, liebe, cinta
eat, eat, 吃, essen, makan
ilovegithub, i love github, 我愛 Github, ich liebe Github, Saya cinta pada Github

output (de.json)

{"you":"Du","I":"ich","love":"liebe","eat":"essen","ilovegithub":"ich liebe Github"}

output (en.json)

{"you":"you","I":"I","love":"love","eat":"eat","ilovegithub":"i love github"}

output (my.json)

{"you":"kamu","I":"Saya","love":"cinta","eat":"makan","ilovegithub":"Saya cinta pada Github"}

output (zh_TW.json)

{"you":"你","I":"我","love":"喜歡","eat":"吃","ilovegithub":"我愛 Github"}

Try Advance

When the sentence includes splitter

i18n=>, en, zh_TW, de, my
ilovegithub, "i love github but u", "我愛 github,但我也愛 git", was du gesagt, "saya pun"

Try Nest

i18n-generator covers the nesting, use => to open, <= to close

i18n=>, en, zh_TW, de, my
ilovegithub, i love github, 我愛 Github, ich liebe Github, Saya cinta pada Github
=> global
sleep, sleep, 睡覺, schlafen, tidur
morning, morning, 早安, Morgen, pagi
=> people
Ahmad, Ahmad, Ahmad, Ahmad, Ahmad
<=
Back, back, 回來, terug, balik

It's work! Cool right ? You can try it on online demo tools

License

Copyright (c) 2014-Present Huei Tan. Licensed under the MIT license.