Skip to content

Commit

Permalink
docs: update README and Options's type document
Browse files Browse the repository at this point in the history
  • Loading branch information
NamesMT committed Feb 27, 2024
1 parent f24cfb6 commit 04b1e1e
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 9 deletions.
12 changes: 8 additions & 4 deletions README.md
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion eslint.config.js
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -20,6 +20,7 @@
"rollup",
"transform",
"spreadsheet",
"generation",
"excel",
"xlsx",
"csv",
Expand Down
48 changes: 44 additions & 4 deletions src/types.ts
Expand Up @@ -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
Expand All @@ -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
*/
Expand Down

0 comments on commit 04b1e1e

Please sign in to comment.