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

v0.1.3

Published

Convert editor json files with a given template into more complex vue-i18n json files

Downloads

66

Readme

i18n-converter

This converter helps to transfer translations received in an excel file to our i18n JSON-Files.

Installation

npm install i18n-converter

Usage

Your i18n files

Your translation files are separate json files for every market like this:

translations
├── DE.json
├── US.json
├── CA.json
├── GB.json
├── ES.json
├── FR.json
├── IT.json
└── MX.json

Your editor file

You need to add a file called EDITOR_FILE.json or EDITOR_FILE_EXCEL_COPY_PASTE to the directory where your translations are. Alternatively you can choose to use data that is in your clipboard. (copied from an excel file)

The script can use in two ways: ReplacementKeys or KeyPaths

ReplacementKeys

Your i18n files contain keys which are used as placeholders for translations. The script will replace the keys with the translations from the editor file.

KeyPaths

No preparation of your i18n-json file is needed. The editor file contains key paths where the translation has to be in the i18n files. The script will add the translations to the i18n files.

Editor file: Option 1: EDITOR_FILE.json

EDITOR_FILE.json with the following format:

[
  {
    "KeyPath": "test.automotive",
    "DE": "Automobil",
    "US": "...",
    "CA": "...",
    "GB": "...",
    "ES": "...",
    "FR": "...",
    "IT": "...",
    "MX": "..."
  }
]

Editor file: Option 2: EXCEL_COPY_PASTE

EDITOR_FILE_EXCEL_COPY_PASTE.json with the following format:

IMPORTANT: Separators has to be tabs

test.automotive	Automobil	Automotive    Automotive	Automotive	Automoción	Automoción	Automobile	Automotive

The first column has to be the keypath or the replacement key The following columns has to be the translations (ORDER: DE, US, CA, GB, ES, MX, FR, IT)

Run script

Run the script with the following command: Navigate to the directory where your translations are and run the following command:

i18n-converter run

Things you might stumble over

  • The translations may contain line breaks which could break the JSON format if not escaped => remove line breaks before converting
  • Use market GB instead of UK in the EDITOR_FILE.json
  • Use Key in EDITOR_FILE.json instead of e.g. ID/Text Key

Development

Make npm script available on your local machine

npm link