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-xlsx-to-json-directory

v0.5.1

Published

Library that converts xlsx file into json directory structure used by i18next, and vice versa.

Downloads

14

Readme

i18n-xlsx-to-json-directory

Library that converts and downloads multilingual data stored in xlsx files into a JSON directory structure, and vice versa. The directory structure is tailored to the i18next library.

Features

Supporting a wide variety of execution environments

Supports direct execution via npx commands. It also supports importing from browser and Node environments.

Select whether to compress the JSON directory

When converting to a JSON directory, you can choose whether to compress to a zip file. It's also possible in reverse.

Auto-creating index.js/ts files

You can choose whether to create an index.js/ts file for importing multilingual data into your project.

Can create template xlsx files

Create a template xlsx file to get you started easily.

Direct usage

Examples of commands that can be executed directly from the terminal include the following.

Without auto-compressing/extracting JSON directory and auto-generating index.js:

npx i18n-xlsx-to-json-directory template-xlsx -d ./template_i18n.xlsx
npx i18n-xlsx-to-json-directory xlsx-to-json-zip -s ./template_i18n.xlsx -d ./i18n.zip --export-file-type js
npx i18n-xlsx-to-json-directory json-zip-to-xlsx -s ./i18n.zip -d ./i18n.xlsx

With auto-compressing/extracting JSON directory auto-generating index.ts:

npx i18n-xlsx-to-json-directory template-xlsx -d ./template_i18n.xlsx
npx i18n-xlsx-to-json-directory xlsx-to-json-zip -s ./template_i18n.xlsx -d ./i18n --export-file-type ts --auto-extract
npx i18n-xlsx-to-json-directory json-zip-to-xlsx -s ./i18n -d ./i18n.xlsx --auto-compress

template-xlsx

Create and save template xlsx files.

options

-d, --destination: The path on which the converted file will be stored.

xlsx-to-json-zip

After converting the xlsx file into a json directory structure, compress it to create and download a zip file.

options

-s, --source: The path to import the file you want to convert.

-d, --destination: The path on which the converted file will be stored.

--auto-extract: Automatically decompress converted zip files. You must specify a directory in the -d option.

--export-file-type: Creates a default index script file that exports each language and namespace.('js' || 'ts' || undefined)

json-zip-to-xlsx

After analyzing the zip file, create and download the xlsx file.

options

-s, --source: The path to import the file you want to convert.

-d, --destination: The path on which the converted file will be stored.

--auto-compress: Automatically compresses and converts the selected directory. You must specify a directory in the -d option.

Usage in a browser environment

Import the library into the script file as follows.

import {
  createTemplateXlsx,
  convertXlsxToJsonZip,
  convertJsonZipToXlsx,
} from 'i18n-xlsx-to-json-directory/browser';

createTemplateXlsx()

Create and save template xlsx files.

convertXlsxToJsonZip(file, options)

After converting the xlsx file into a json directory structure, compress it to create and download a zip file.

options

exportFileType: Creates a default index script file that exports each language and namespace.('js' || 'ts' || undefined)

convertJsonZipToXlsx(file)

After analyzing the zip file, create and download the xlsx file.

Usage in Node.js environment

Import the library into the script file as follows.

import {
  createTemplateXlsx,
  convertXlsxToJsonZip,
  convertJsonZipToXlsx,
} from 'i18n-xlsx-to-json-directory/node';

createTemplateXlsx(destination)

Create and save template xlsx files.

convertXlsxToJsonZip(source, destination, options)

After converting the xlsx file into a json directory structure, compress it to create and download a zip file.

options

autoExtract: Automatically decompress converted zip files. You must specify a directory in the -d option.

exportFileType: Creates a default index script file that exports each language and namespace.('js' || 'ts' || undefined)

convertJsonZipToXlsx(source, destination, options)

After analyzing the zip file, create and download the xlsx file.

options

autoCompress: Automatically compresses and converts the selected directory. You must specify a directory in the -d option.

Troubleshooting

SSL certificate issue occurred with SheetJS dependency.

You can fix the problem by referring to the SheetJS library website.

Contributing

Pull requests are always welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

Apache License Version 2.0

Reference