weblate-luau

Crates.ioweblate-luau
lib.rsweblate-luau
version0.1.0
created_at2025-09-22 17:32:48.734779+00
updated_at2025-09-22 17:32:48.734779+00
descriptionGenerates a Luau table for weblate translations that are represented in basic JSON
homepage
repository
max_upload_size
id1850428
size27,665
(MrElectrify)

documentation

README

Weblate-Luau

This tool is intended to translate simple JSON weblate translation files as described by Weblate Documentation 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.

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:

Language Frostbite Code Additional Codes
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:

{
  "a": {
    "b": {
      "c": {
        "en": "string"
      }
    }
  }
}

will be converted to:

{
    ["a.b.c"] = {
        en = "string"
    },
}
Commit count: 0

cargo fmt