Skip to main content

A command-line tool to streamline the process of updating language files for Minecraft Java Edition modpacks.

Project description

UpLang

PyPI version Python 3.11+ License: MIT Tests Downloads

UpLang is a powerful command-line tool designed to streamline localization workflows for Minecraft Java Edition modpacks. It automates the complex process of managing translation files across multiple mods, ensuring perfect synchronization between English and Chinese language files while preserving translation integrity and key ordering.

๐Ÿš€ Key Features

  • ๐Ÿ” Intelligent Mod Detection: Automatically scans and tracks new, updated, and deleted mods
  • ๐Ÿ”„ Smart Synchronization: Maintains translation order while adding missing keys and removing obsolete ones
  • ๐Ÿ›ก๏ธ Robust Error Handling: Advanced JSON parsing with multiple fallback strategies for malformed files
  • ๐Ÿ“Š Progress Tracking: Rich console interface with real-time progress indicators
  • ๐ŸŒ Cross-Platform: Works seamlessly on Windows, macOS, and Linux
  • โšก Incremental Updates: Efficient delta processing for large modpacks
  • ๐ŸŽฏ Order Preservation: Maintains original key ordering in language files

๐Ÿ“‹ System Requirements

  • Python: 3.11 or higher
  • Operating System: Windows, macOS, or Linux
  • Minecraft: Java Edition (Forge/Fabric mods)

๐Ÿ› ๏ธ Installation

Option 1: From PyPI (Recommended)

The easiest way to install UpLang is directly from PyPI:

# Install UpLang
pip install uplang

# Verify installation
uplang --help

Option 2: Development Installation

For contributing or development purposes:

# Clone the repository
git clone https://github.com/QianFuv/UpLang.git
cd UpLang

# Using uv (recommended for development)
pip install uv
uv sync
uv pip install -e .

# Or using pip directly
pip install -e .

๐Ÿ“– Usage

Initial Setup

For new projects or when setting up a new resource pack:

uplang init <mods_directory> <resource_pack_directory>

Example:

uplang init "~/.minecraft/mods" "./MyResourcePack"

What it does:

  • ๐Ÿ” Scans all JAR files in the mods directory
  • ๐Ÿ“‚ Creates the necessary assets/<mod_id>/lang/ structure
  • ๐Ÿ“„ Extracts en_us.json from each mod
  • ๐Ÿ”„ Copies or creates zh_cn.json files
  • โš™๏ธ Performs initial synchronization
  • ๐Ÿ’พ Saves project state for future comparisons

Updating Translations

When you add, update, or remove mods:

uplang check <mods_directory> <resource_pack_directory>

Example:

uplang check "~/.minecraft/mods" "./MyResourcePack"

What it does:

  • ๐Ÿ“Š Compares current state with previous scan
  • ๐Ÿ†• Identifies new, updated, and deleted mods
  • ๐Ÿ”„ Merges new translation keys into existing files
  • ๐Ÿงน Removes obsolete keys
  • โœ… Synchronizes all language files
  • ๐Ÿ’พ Updates project state

๐Ÿ“ Output Structure

After running UpLang, your resource pack will have this structure:

MyResourcePack/
โ”œโ”€โ”€ assets/
โ”‚   โ”œโ”€โ”€ mod_one/
โ”‚   โ”‚   โ””โ”€โ”€ lang/
โ”‚   โ”‚       โ”œโ”€โ”€ en_us.json
โ”‚   โ”‚       โ””โ”€โ”€ zh_cn.json
โ”‚   โ”œโ”€โ”€ mod_two/
โ”‚   โ”‚   โ””โ”€โ”€ lang/
โ”‚   โ”‚       โ”œโ”€โ”€ en_us.json
โ”‚   โ”‚       โ””โ”€โ”€ zh_cn.json
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ pack.mcmeta (if it exists)
โ”œโ”€โ”€ .uplang_state.json (project state)
โ””โ”€โ”€ uplang_*.log (operation logs)

๐Ÿงช Testing

Run the comprehensive test suite to verify everything works correctly:

# If installed from PyPI
pip install uplang[test]
python -m pytest tests/test_integration.py -v

# If using development installation
uv run pytest tests/test_integration.py -v
# or
python -m pytest tests/test_integration.py -v

The tests create mock mods, run both init and check commands, and verify all functionality including:

  • Language file extraction
  • Synchronization logic
  • Order preservation
  • Error handling

๐Ÿ”ง Advanced Features

Robust JSON Processing

UpLang handles real-world edge cases:

  • Multiple encodings: UTF-8, UTF-8-sig, Latin1, CP1252
  • Malformed JSON: Trailing commas, unquoted keys, comments
  • Encoding issues: UTF-8 BOM, surrogate characters
  • Recovery strategies: Multiple parsing fallbacks

Translation Preservation

  • Existing translations are always preserved during synchronization
  • Key ordering follows the English language file structure
  • Incremental updates only process changed files for efficiency
  • Atomic operations ensure data integrity

Logging and Monitoring

  • Detailed logs saved to timestamped files
  • Progress indicators for long-running operations
  • Error reporting with context and suggested solutions
  • State tracking for debugging and auditing

๐Ÿค Contributing

We welcome contributions! Please see our Contributing Guide for details on:

  • ๐Ÿ› Reporting bugs
  • ๐Ÿ’ก Suggesting features
  • ๐Ÿ”ง Setting up development environment
  • ๐Ÿ“ Code style guidelines
  • โœ… Testing requirements

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built with Rich for beautiful console output
  • Uses uv for fast dependency management
  • Inspired by the Minecraft modding community's localization needs

๐Ÿ“ž Support


Made with โค๏ธ for the Minecraft modding community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uplang-0.2.1.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uplang-0.2.1-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file uplang-0.2.1.tar.gz.

File metadata

  • Download URL: uplang-0.2.1.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for uplang-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b415989508de5d741ddecc896fa7ea66c398f6af3bb6f8072830a43240cfddfc
MD5 7b3827b1023954de1af7da401ec9239b
BLAKE2b-256 d8e1a547c70c754adf7d5db05d0f13068756b73749294ca2c4b2cd99a4e50f63

See more details on using hashes here.

Provenance

The following attestation bundles were made for uplang-0.2.1.tar.gz:

Publisher: publish-to-pypi.yml on QianFuv/UpLang

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uplang-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: uplang-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for uplang-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 756a0df1d8c052d66382751e94d9a17ffa50a2acc51649de8d4f86995979c0b9
MD5 6407fdc996b119ff0a985eb665400e7f
BLAKE2b-256 ff167c059f18ceb6932489b2a11b265dc798b88e6be7a8a1b4a91f39b25256da

See more details on using hashes here.

Provenance

The following attestation bundles were made for uplang-0.2.1-py3-none-any.whl:

Publisher: publish-to-pypi.yml on QianFuv/UpLang

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page