spreadsheet-i18n
v0.3.8
Published
Enhance internationalization (i18n) workflows with spreadsheets
Maintainers
Readme
spreadsheet-i18n
Overview
spreadsheet-i18n is the core library of the spreadsheet-i18n--mono monorepo, containing the main magics that enables i18n workflows with spreadsheets.
Features
- Supports CSV, TSV, DSV, Excel/Spreadsheets (XLS[XMB], [F]ODS), powered by SheetJS and papaparse
- File-to-file convert:
en.csv -> en.json - File-to-multiple convert:
i18n.csv -> en.json, vi.json, fr.json,... - Output merging:
i18n_a.csv + i18n_b.csv -> en.json - Preserve structure:
a/i18n.csv -> a/en.json | a/i18n/en.json | a/i18n_en.json - File generation:
i18n_files.csv -> cloud_en.json, cloud_fr.json, template_en.html, template_fr.html - And more!
Usage
Install package
# npm
npm install spreadsheet-i18n
# bun
bun add spreadsheet-i18n
# pnpm (recommended)
pnpm install spreadsheet-i18nImport and use
// ESM
import type { Options } from 'spreadsheet-i18n'
import { scanConvert } from 'spreadsheet-i18n'
const options: Options = {
xlsx: true,
comments: '#',
outDir: undefined // output to same directory as its raw files
}
const scanDir = 'locales' // Optionally set a start point for scanning
await scanConvert(options, scanDir)