intlify / intlify/bundle-tools
Support TOML format
- Dominant language
- TypeScript
- Stars
- 270
- Forks
- 46
- PR merge metrics
- No merged PRs in 30d
Description
TOML is a more straitforward format than JSON or YAML, especially it would be much more intuitive for translators without a tech background. So imagine the i18n translation area could be something like this:
```toml
[zh]
"homepage" = "主页"
[zh.about]
"contact" = "联系我们"
"{n} times"="{n} 次" # There's no space between `=`, has leading spaces and it costs no problem
[en]
"homepage" = "Homepage" # comment
[en.about]
"contact" = "Contact Us"
"multiline string" = """are surrounded by three quotation marks
on each side and allow newlines."""
````
Which equals to the following in JSON:
```json5
{
"zh": {
"homepage": "主页",
"about": {
"contact": "联系我们",
"{n} times": "{n} 次"
}
},
"en": {
"homepage": "Homepage", // comment only available with JSON5
"about": {
"contact": "Contact Us",
"multiline string": "are surrounded by three quotation marks\non each side and allow newlines."
}
}
}
```
YAML version:
```yaml
zh:
homepage: 主页
about:
contact: 联系我们
en:
homepage: Homepage #comment
about:
contact: Contact Us
"{n times}": {n} times # inconsistent quote is needed here
multiline string: "are surrounded by three quotation marks\non each side and allow newlines."
```
I think the TOML version is more readable. JSON is too strict and verbose, and YAML is highly reliant on indention which could be more prone to errors. Also it creates inconsistency dealing with quotes. TOML is not indentation sensitive, so you won't mess things up by adding more or less space between the strings. It has comment feature, it's consistent and can do pretty much anything that JSON and YAML can do.
It would be nice if this module could also support TOML
Contributor guide
Assessment
This issue has not been assessed yet.