diff --git a/README.md b/README.md index 7eb2ccb..61ef262 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,16 @@ **unplugin-sheet-i18n** enables doing your i18n in a [spread]sheet for a better collaborative experience with non-coders and maintainability. ## Features -- CSV, DSV, Spreadsheets (XLS[XMB], ODT) parsing, powered by [SheetJS](https://sheetjs.com/) and [papaparse](https://www.papaparse.com/) -- File-to-file convert (en.csv -> en.json) -- File-to-multiple convert (i18n.csv -> en.json, vi.json, fr.json,...) -- Multiple sheets support (for big projects) +- Supports CSV, DSV, Excel/Spreadsheets (XLS[XMB], ODT), powered by [SheetJS](https://sheetjs.com/) and [papaparse](https://www.papaparse.com/) +- 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` +- File generation: `i18n_files.csv -> cloud_en.json, cloud_fr.json, template_en.html, template_fr.html` +- And more! ## Usage +[>See a few examples usage here<](./playground) + ### Install package: ```sh # npm diff --git a/eslint.config.js b/eslint.config.js index e66ab16..14ed8e3 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -9,7 +9,14 @@ export default antfu( }, { rules: { - // overrides + 'style/no-trailing-spaces': ['error', { ignoreComments: true }], + 'style/max-statements-per-line': ['error', { max: 2 }], + }, + }, + { + files: ['*.md'], + rules: { + 'style/no-trailing-spaces': 'off', }, }, unocss, diff --git a/package.json b/package.json index 23f3564..698deb7 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "rollup", "transform", "spreadsheet", + "generation", "excel", "xlsx", "csv", diff --git a/src/types.ts b/src/types.ts index 763e9d8..d59f023 100644 --- a/src/types.ts +++ b/src/types.ts @@ -74,9 +74,41 @@ export interface Options { replacePunctuationSpace?: boolean /** - * // TODO: documents this * Enables special processing for $JSON keys * + * Key syntax: `$JSON;[fileName];[selectors];[path];[key]` + * + * Example: + * ```txt + * For a key: + * $JSON;cloud;id:what;a.nested.path;display - What? + * + * We will get a file: cloud_[locale] with the content: + * """ + * [ + * { + * "__selectorKeys": [ + * "id" + * ], + * "id": "what", + * "a": { + * "nested": { + * "path": { + * "i18n": { + * "en": { + * "display": "What?" + * } + * } + * } + * } + * } + * } + * ] + * """ + * ``` + * + * //TODO: add util for checking an object againts the outputted JSON array, util to load the internalization text from the outputted format + * * jsonProcessor will always work in auto locale columns mode, and exported file will be 'flat' * * @default false @@ -93,10 +125,18 @@ export interface Options { jsonProcessorClean?: boolean /** - * // TODO: documents this * Enables special processing for $FILE keys - * - * jsonProcessor will always work in auto locale columns mode, and exported file will be 'flat' + * + * Key syntax: `$FILE;[fileName];[extension]`, + * extension is optional and defaults to 'txt' + * + * Example: + * ```txt + * For a key: + * $FILE;hi_there;md - Halo + * + * We will get a file: hi_there_[locale].md with the content: "Halo" + * ``` * * @default false */