/WoWLocaleTool

Automatically find and create i18n translation files

Primary LanguagePythonMIT LicenseMIT

WoWLocaleTool

⚠️ IMPORTANT NOTICE ⚠️

🤖 This project was generated by AI based on personal instructions. It has not been fully tested, so not all features may work as expected. Please backup your original files before use.


WoWLocaleTool is a Python script designed to extract localization strings from Lua files in World of Warcraft addons. It recursively scans all Lua files in a specified directory (including subdirectories), extracts localization strings based on WOW ACE3Local implementation, and saves them into a single Lua file.

Features

  • Recursively scan all Lua files in the specified directory
  • Support for custom directory exclusion
  • Extract multiple localization string identifiers (default: L, AL, C)
  • Save extracted strings to a single Lua file with source file comments
  • Support for custom file encoding
  • Display processing progress and total execution time
  • Cross-platform compatibility (Windows, Linux, macOS)

System Requirements

  • Python 3.6+

Installation

  1. Clone or download this repository to your local machine.
  2. Ensure you have Python 3.6 or higher installed on your system.

Usage

Run the script from the command line using the following format:

python wowlocale_tool.py [options]

Optional Arguments

Argument Long Form Description
-s --source Source directory (default: script directory)
-t --target Target directory (default: "Dict" folder in script directory)
-e --exclude Additional directories to exclude
-c --encoding File encoding (default: utf-8)
-i --identifiers List of localization string identifiers (default: L,AL,C)

Examples

  1. Using default settings:

    python wowlocale_tool.py
  2. Specifying source and target directories:

    python wowlocale_tool.py -s /path/to/addon -t /path/to/output
  3. Adding extra exclude directories and using custom encoding:

    python wowlocale_tool.py -e extra_dir1 extra_dir2 -c utf-16
  4. Using custom localization string identifiers:

    python wowlocale_tool.py -i L,T,X

Output

The script generates a file named localization_strings.lua in the specified target directory. This file contains all extracted localization strings in the following format:

--/path/to/file1.lua
L["string1"] = "string1"
L["string2"] = "string2"

--/path/to/file2.lua
L["string3"] = "string3"
L["string4"] = "string4"

Notes

  • Directories excluded by default: Language, lang, Local, locales, locale, locals, dict (case-insensitive).
  • The script automatically creates the target directory if it doesn't exist.
  • Progress and total execution time are displayed to monitor processing of large addons.

Contributing

Issue reports and pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License

MIT