A command-line tool to streamline the process of updating language files for Minecraft Java Edition modpacks.
Project description
UpLang
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.
โ ๏ธ Development Notice: UpLang is currently in active development and rapid iteration. While stable for production use, new features and improvements are being added frequently. Please check the releases page for the latest updates and consider updating regularly to benefit from new features and bug fixes.
๐ 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.jsonfrom each mod - ๐ Copies or creates
zh_cn.jsonfiles - โ๏ธ 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:
# Run all tests
PYTHONPATH=src python -m pytest tests/ -v
# Run with coverage report
PYTHONPATH=src python -m pytest tests/ --cov=uplang --cov-report=html
# Run specific test modules
PYTHONPATH=src python -m pytest tests/test_json_utils.py -v # JSON processing tests
PYTHONPATH=src python -m pytest tests/test_models.py -v # Data model tests
PYTHONPATH=src python -m pytest tests/test_utils.py -v # Utility function tests
# If using development installation with uv
uv run pytest tests/ -v
The test suite includes:
- Data Model Testing: Comprehensive validation of mod objects, comparison results, and sync statistics
- JSON Processing: Robust parsing with encoding fallbacks, malformed JSON recovery, and order preservation
- Utility Functions: Filename sanitization, mod ID creation, and path handling
- Error Handling: Edge cases, invalid inputs, and graceful recovery strategies
- Unicode Support: International characters, emoji, and encoding edge cases
- Order Preservation: Ensures JSON key ordering is maintained during operations
Current Test Coverage
- โ Data Models: Mod metadata, comparison results, synchronization statistics
- โ JSON Processing: Multi-encoding support, malformed JSON recovery, OrderedDict preservation
- โ Utility Functions: Safe filename handling, mod ID generation, string operations
- โ Error Handling: Exception hierarchy and context preservation
- โ Unicode Handling: International character support and encoding fallbacks
๐ง 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
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ง Contact: Project Maintainer
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uplang-0.2.7.tar.gz.
File metadata
- Download URL: uplang-0.2.7.tar.gz
- Upload date:
- Size: 27.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55982121d65b18e84fa1b43930c935734284827f2c6e97ac71f21133ae90f4f8
|
|
| MD5 |
fb111de11bfe21ad06dc8aa39bafc660
|
|
| BLAKE2b-256 |
b10aa6f36ecb908ff630dfc9a21fb93dd2616e24296fbcad7966ea4093a36529
|
Provenance
The following attestation bundles were made for uplang-0.2.7.tar.gz:
Publisher:
publish-to-pypi.yml on QianFuv/UpLang
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uplang-0.2.7.tar.gz -
Subject digest:
55982121d65b18e84fa1b43930c935734284827f2c6e97ac71f21133ae90f4f8 - Sigstore transparency entry: 555114136
- Sigstore integration time:
-
Permalink:
QianFuv/UpLang@af3548723fa96b5a6ac5189c4b32c8e543af15c0 -
Branch / Tag:
refs/tags/0.2.7 - Owner: https://github.com/QianFuv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@af3548723fa96b5a6ac5189c4b32c8e543af15c0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file uplang-0.2.7-py3-none-any.whl.
File metadata
- Download URL: uplang-0.2.7-py3-none-any.whl
- Upload date:
- Size: 36.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ae0617e7326a7b5b176c02202701cbc92aef29341f3e2ac9c0428863204bc8a
|
|
| MD5 |
62905dd5cee9291584ce83e6a9d1d3d6
|
|
| BLAKE2b-256 |
4cbe2faf117e1ae92764cb22582f688f209fb3b3eb1d5d28cec91e64a6919d64
|
Provenance
The following attestation bundles were made for uplang-0.2.7-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on QianFuv/UpLang
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
uplang-0.2.7-py3-none-any.whl -
Subject digest:
2ae0617e7326a7b5b176c02202701cbc92aef29341f3e2ac9c0428863204bc8a - Sigstore transparency entry: 555114153
- Sigstore integration time:
-
Permalink:
QianFuv/UpLang@af3548723fa96b5a6ac5189c4b32c8e543af15c0 -
Branch / Tag:
refs/tags/0.2.7 - Owner: https://github.com/QianFuv
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@af3548723fa96b5a6ac5189c4b32c8e543af15c0 -
Trigger Event:
release
-
Statement type: