APITable Settings Generator convert APITable datasheet into JSON data.
For example, you have APITable like this:
name | emoji | category |
---|---|---|
jack_o_lantern | 🎃 | A |
christmas_tree | 🎄 | B |
fireworks | 🎆 | A |
sparkler | 🎇 | C |
firecracker | 🧨 | D |
It will generate JSON settings like this:
{
"jack_o_lantern": {
"emoji": "🎃",
"category": "A"
},
"christmas_tree": {
"emoji": "🎄",
"category": "B"
},
"fireworks": {
"emoji": "🎆",
"category": "A"
},
"sparkler": {
"emoji": "🎇",
"category": "C"
},
"firecracker": {
"emoji": "🧨",
"category": "D"
}
}
- Localization
- Features Flag
- Remote Config
- Software Settings
- Game Development
- ......
APITable Settings Generator provides 5 generated settings format:
rows
(default)columns
array
column-files
properties-files
Assume you have this APITable:
id | en_US | zh_CN |
---|---|---|
login_title | Login APITable | 中文 APITable |
some text | some text en_US | some text zh_CN |
APITable Settings Generator generate settings in different mode:
You have this JSON config file config.json
:
[
{
"dirName": "./generated",
"fileName": "i18n.generated.json",
"tables": [
{
"datasheetId": "dstbUhd5coNXQoXFD8",
"datasheetName": "strings",
"format": "rows",
"params": {}
}
]
}
]
Run APITable Settings Generator (asg
):
# run in bash
npx apitable-settings-generator --config config.json --token ${HERE_IS_YOUR_APITABLE_TOKEN}
Generated settings i18n.generated.json
:
{
"strings": {
"login_title": {
"en_US": "Login APITable",
"zh_CN": "中文APITable"
},
"some text": {
"en_US": "some text en_US",
"zh_CN": "some text zh_CN"
}
}
}
You have this JSON config file config.json
:
[
{
"dirName": "./generated",
"fileName": "i18n.generated.json",
"tables": [
{
"datasheetId": "dstbUhd5coNXQoXFD8",
"datasheetName": "strings",
"format": "columns",
"params": {}
}
]
}
]
Run APITable Settings Generator (asg
):
# run in bash
npx asg --config config.json --token ${HERE_IS_YOUR_APITABLE_TOKEN}
Generated settings i18n.generated.json
:
{
"strings": {
"zh_CN": {
"login_title": "中文APITable",
"some text": "some text zh_CN"
},
"en_US": {
"login_title": "Login APITable",
"some text": "some text en_US"
}
}
}
You have this JSON config file config.json
:
[
{
"dirName": "./generated",
"fileName": "i18n.generated.json",
"tables": [
{
"datasheetId": "dstbUhd5coNXQoXFD8",
"datasheetName": "strings",
"format": "array",
"params": {}
}
]
}
]
Run APITable Settings Generator (asg
):
# run in bash
npx apitable-settings-generator --config config.json --token ${HERE_IS_YOUR_APITABLE_TOKEN}
Generated settings i18n.generated.json
:
{
"strings": [
{
"id": "login_title",
"en_US": "Login APITable",
"zh_CN": "中文APITable"
},
{
"id": "some text",
"en_US": "some text en_US",
"zh_CN": "some text zh_CN"
}
]
}
This format will separate columns into different files.
You have this JSON config file config.json
:
[
{
"dirName": "./generated",
"fileName": "i18n.*.generated.json",
"tables": [
{
"datasheetId": "dstbUhd5coNXQoXFD8",
"datasheetName": "strings",
"format": "column-files",
"params": {}
}
]
}
]
Run APITable Settings Generator (asg
):
# run in bash
npx apitable-settings-generator --config config.json --token ${HERE_IS_YOUR_APITABLE_TOKEN}
Generated settings i18n.en_US.generated.json
:
{
"strings": {
"en_US": {
"login_title": "Login APITable",
"some text": "some text en_US"
}
}
}
Generated settings i18n.zh_CN.generated.json
:
{
"strings": {
"zh_CN": {
"login_title": "中文APITable",
"some text": "some text zh_CN"
}
}
}
.properties
is a file extension for files that store configurable parameters for an application. They can also store strings for internationalization and localization, and such files are called Property Resource Bundles.
Usually the format of the file contents is key=value
.
So the files need to be saved according to the different languages when they are generated
You have this JSON config file config.json
:
[
{
"dirName": "./generated",
"fileName": "i18n_*.properties",
"languageList"?: [
"zh_CN",
"en_US"
],
"tables": [
{
"datasheetId": "dstbUhd5coNXQoXFD8",
"datasheetName": "i18n",
"format": "properties-files",
"params"?: {...}
}
]
}
]
Note: We have provided an interesting parameter
languageList
here. when you have many internationalized language settings, then you can specify parameters to control the list of accepted languages.example: languageList:["zh_CN"]
Run APITable Settings Generator (asg
):
# run in bash
npx apitable-settings-generator --config config.json --token ${HERE_IS_YOUR_APITABLE_TOKEN}
Generated settings i18n_en_US.properties
:
long_text=Hello apitable
short_text=Hello
Generated settings i18n_zh_CN.properties
:
long_text=你好 apitable
short_text=你好
Tips:
- When you have the following list of languages
i18n_en_US.properties
i18n_zh_CN.properties
When you only need the zh_CN
configuration package, you can now use the languageList
attribute to control the output files, e.g.
...
languageList: ['zh-CN']
...
Now only the language file i18n_zh_CN.properties
you specified will be output
We make some convetion that help you do more magic work:
- Ignore the column that name starts with
.
; - Ignore the Primary Key that valut starts with
.
;
If you want to more features, please new an issue for us.