# Weblate-Luau
This tool is intended to translate simple JSON weblate translation files as described
by [Weblate Documentation](https://docs.weblate.org/en/latest/formats/json.html) into Lua(u) objects. The output
is valid in both Lua and Luau languages and is intended for use in Warsaw Revamped scripts alongside the
[`localization` package](https://gitlab.com/warsaw-revamped-oss/modding/localization).
## Usage
```
Generates a Luau table for weblate translations that are represented in basic JSON.
Usage: weblate-lua <ROOT> <OUTPUT>
Arguments:
<ROOT> The root path of the localization folder
<OUTPUT> The path to the output file
Options:
-h, --help Print help
-V, --version Print version
```
## Supported Structures
Only languages supported by Battlefield 4 are supported. This includes:
| English | `en` | `en_US`, `en_GB` |
| French | `fr` | `fr_FR`, `fr_CA` |
| Italian | `it` | `it_IT` |
| German | `de` | `de_DE` |
| Spanish - Spain | `es` | `es_ES` |
| Czech | `cs` | `cs_CZ` |
| Korean | `ko` | `ko_KR` |
| Polish | `pl` | `pl_PL` |
| Portuguese - Brazil | `br` | `pt`, `pt_BR`, `pt_PT` |
| Russian | `ru` | `ru_RU` |
| Chinese - Traditional | `zh` | `zh_ZH`, `zh_TW` |
| Japanese | `ja` | `ja_JP` |
The tool collects translations in order of:
1. A file with the name `{frostbite_code}.json`
2. All JSON files in a folder named `{frostbite_code}`
3. A file with the name `{additional_code-n}.json`
4. All JSON files in a folder named `{additional_code-n}`
## Nested Translations
Nested translations are handled by forming a complete path separated by periods. For example, the following:
```json
{
"a": {
"b": {
"c": {
"en": "string"
}
}
}
}
```
will be converted to:
```lua
{
["a.b.c"] = {
en = "string"
},
}
```