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 Code Quality Documentation 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.2.tar.gz (25.4 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.2-py3-none-any.whl (34.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: uplang-0.2.2.tar.gz
  • Upload date:
  • Size: 25.4 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.2.tar.gz
Algorithm Hash digest
SHA256 f43736daf743bff21df51072872d7aec5f69290b77018f824a676f242170bc33
MD5 e8d45cb09ffbf9723d99fb541198ec95
BLAKE2b-256 daaa3c233d7449f0f5c8e61f2452c3dabb734f1098581fa53c3ac30962c16cef

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: uplang-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 34.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e2b0f594796965dce491de243386535a9972c4e4092d50b6c79bc89b2a98630d
MD5 32d17de3d56def0cb827d43a559e85b4
BLAKE2b-256 4683f126921647ee773d143074e76635da29f1bc44786abfd65c170035331dbd

See more details on using hashes here.

Provenance

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