Quests Lang Splitter
Introduction
This mod provides functionality for splitting language files, which simplifies version control, and also adds several useful commands for working with localization.
Features
Commands
split - splits the language file into separate categories. For quests, tasks, and quest links, grouping is done by chapters.
lang/
├─ en_us/
│ ├─ chapters/
│ │ ├─ chapter1.snbt # Contains quest, task, and link identifiers
│ │ ├─ chapter2.snbt
│ │ └─ chapter3.snbt
│ ├─ chapter.snbt # Chapter names
│ ├─ chapter_group.snbt # Chapter group names
│ ├─ file.snbt # Quest book name
│ └─ reward_table.snbt # Reward table names
└─ en_us.snbt # Original file, updates from split files when loaded/reloaded
replace_unmerged: boolean value (usually use false unless you want to overwrite previously generated and non-merged split files)
locale: locale code (e.g., pt_br, zh_ch, ko_kr)
/langsplitter split <replace_unmerged> [<locale>]
# If no locale is specified, all available language files will be split
fill_missing_translation - fills missing language entries based on the en_us locale and performs splitting.
Note: You can check all newly added entries in the debug.log file.
/langsplitter fill_missing_translation <replace_unmerged> <locale>
purge_merged - when loading or reloading quests, if there are available split files to read, they are merged into the original file and then renamed to .snbt_merged. This command allows you to clean them from the folder if they are in the way.
/langsplitter purge_merged
Usage
Setting up .gitignore:
# FTB Quests Lang Splitter
# ignore original language files like en_us.snbt
config/ftbquests/quests/lang/.snbt
# ignore recovery files
config/ftbquests/quests/lang/recovery/.snbt
# ignore already merged files
config/ftbquests/quests/lang/*/.snbt_merged
For translators:
- Start with the
fill_missing_translationcommand to generate files with all entries - Translate the necessary elements
- Execute
/ftbquests reloadto merge changes - Now your files will be renamed to .snbt_merged
- For further changes, you can:
- Run the
splitcommand again to generate the file - Or edit files with the
.snbt_mergedextension and after completion rename them back to.snbt - Then reload again to merge new changes
- If everything is ready for commit, run
splitone last time and create a PR with the relevant files
For maintainers:
- Update .gitignore in your repository
- Now the /lang/ folder should contain only locale folders, not files
- To create initial files, run the
splitcommand and commit the files - After setting up the folders, you can delete the original locale .snbt files (they are now automatically generated when merging from split files at runtime)
- From now on, only accept PRs/commits from split files
About the recovery folder:
- When merging files that replace an existing entry (e.g., when retranslating an entry), a backup of that entry will be created in the
recoveryfolder - A file with a name like
enus<timestamp>.snbtwill be generated (e.g.,en_us_1755120819.snbt)