Skip to content

Commit

Permalink
custom jsoner: 40->15k
Browse files Browse the repository at this point in the history
  • Loading branch information
eddow committed Jun 5, 2024
1 parent 0358c24 commit 3b2a568
Show file tree
Hide file tree
Showing 13 changed files with 441 additions and 395 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Two are provided: a [`MemDB`](./docs/db.md#memdb) who is basically an "in-memory
- reading from a file
- maintaining the files when changes are brought

The `FileDB` uses a human-accessible (using [json5](https://json5.org/) for custom types) and based on `\t` indentation file format only proper for this usage.
The `FileDB` uses a human-accessible js-like format for custom types) and based on `\t` indentation file format only proper for this usage.

Having the translators managing translations in the UI while the devs have to access the file to add/remove keys, change their zone, ... and all this to go through git commits (so, to have local changes that will be integrated in the project after push/merge) can be done with `FileDB` - for this, just interface a `PUT` to a call on `InteractiveServer::modify` (while that server has a `FileDB` as a source) then the new file will be saved soon with the modified values.

Expand Down
6 changes: 3 additions & 3 deletions docs/db.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ For each key, the callback calls will be `onKey - onText* - endKey` for each key

The serialization file-format is specific for regexp-ability _and_ human interactions; grouping is done by indentation (made with tabulations - `\t`).

`KeyInfos` and `TextInfos` are stored in [`json5`](https://json5.org/) format
`KeyInfos` and `TextInfos` are stored in human-accessible js-like format

##### 0-tabs

Expand All @@ -153,7 +153,7 @@ A line beginning with no tabs is a key specification
```

```
[text-key][{ SomeKeyInfos: 'json5 format' }]:[zone]
[text-key][{ SomeKeyInfos: 'jju format' }]:[zone]
```

> Note: the zone can and will often be `""`
Expand All @@ -167,7 +167,7 @@ A line beginning with one tab is a locale specification for the key "en cours"
```

```
[locale][{ SomeTextInfos: 'json5 format' }]:Some fancy translation
[locale][{ SomeTextInfos: 'value' }]:Some fancy translation
```

##### 2-tabs
Expand Down
2 changes: 0 additions & 2 deletions docs/umd.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ Static websites will have to expose static translations files, import a library

For now, the file `lib/omni18n.js` is the file to be copied and referred to in the html script tag.

Note: until now (1.1.8), the compressed library is 40k - it might be an overkill as the library is designed for fullstack optimization. The big thing that can still be profitable even in static websites is the [interpolation engine](./interpolation.md), that it translates on-the-fly (without reloading the page) and that it works out of the box.

## Script

UMD (static websites) use no zones (only the main one). Therefore, a global `T` variable is the only [Translator](./translator.md). An event is raised when it is loaded/changed
Expand Down
Loading

0 comments on commit 3b2a568

Please sign in to comment.