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 Python License 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.

๐ŸŒ Languages

English | ็ฎ€ไฝ“ไธญๆ–‡

๐Ÿš€ 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
  • ๐Ÿ“š Professional Documentation: Comprehensive docstrings and code comments
  • ๐Ÿ”ง Dependency Injection: Clean architecture with testable components

๐Ÿ“‹ 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
PYTHONPATH=/path/to/UpLang/src python -m pytest tests/test_integration.py -v

The test suite includes:

  • Mock mod generation: Creates realistic test scenarios
  • End-to-end testing: Full init and check command workflows
  • Edge case coverage: Malformed JSON, encoding issues, error conditions
  • State verification: Validates state persistence and change detection
  • Order preservation: Ensures key ordering is maintained
  • Error recovery: Tests fallback strategies and error handling

Current Test Status

  • โœ… Integration Tests: Complete workflow testing
  • โœ… JSON Processing: Robust parsing and encoding handling
  • โœ… State Management: Project state persistence and comparison
  • โœ… Error Handling: Exception hierarchy and recovery strategies
  • โœ… Order Preservation: Key ordering maintenance verification

๐Ÿ”ง 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

Code Quality Standards

  • Comprehensive Documentation: All modules, classes, and methods include detailed docstrings
  • Type Safety: Complete type annotations throughout the codebase
  • Error Handling: Hierarchical exception system with context information
  • Clean Architecture: Dependency injection and separation of concerns
  • Professional Standards: Industry-grade code organization and documentation

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.4.tar.gz (26.2 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.4-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uplang-0.2.4.tar.gz
  • Upload date:
  • Size: 26.2 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.4.tar.gz
Algorithm Hash digest
SHA256 ec1471adb2b95ea47d17be9b433ff7868085047e4fdc6c3fc24d4045624a02ad
MD5 b9a2f37d5a68943a693e0b6a5e41f9ac
BLAKE2b-256 2b080e42749a0102ec9ca0b13ead5f8d4c1de42856e840dd1b61898fcf79942c

See more details on using hashes here.

Provenance

The following attestation bundles were made for uplang-0.2.4.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.4-py3-none-any.whl.

File metadata

  • Download URL: uplang-0.2.4-py3-none-any.whl
  • Upload date:
  • Size: 35.3 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 946b4d0f62964ecc275595abfc67c877a40df1e9248ba36c19289b2184f5be0c
MD5 5cc89c2c85708085c418978e4e330ed1
BLAKE2b-256 66fe579b69750ad3a8f1f8524cdb2d3c3ec5324a2906fc6b11dd3fed5b2e9219

See more details on using hashes here.

Provenance

The following attestation bundles were made for uplang-0.2.4-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