Skip to content

Documentation

Chryfi edited this page Jul 26, 2022 · 6 revisions

The documentation of the most important parts of the Blockbuster Mod code.


Language files

You should edit the translations in the respective language folder under the help/ directory, for example, help/ru_RU/gui.yml is for Russian GUI language strings. You should not edit the .lang files under src/main/ressources/assets/blockbuster/lang/, because they will be overridden when building the mod.

Nesting of language keys

If you want to quote another language string without copy-pasting, you can do so by calling the path to the language key in curly braces like this {file_name.key1.key2}. The language key will be resolved in the respective language directory.

Example:

In help/en_US/gui.yml we have:

render_always_tooltip: Render the model block even when the Blockbuster config {config.model_block.model_block_disable_rendering} option is enabled.

The string {config.model_block.model_block_disable_rendering} refers to the file help/en_US/config.yml and to the language key model_block.model_block_disable_rendering. The value of that language string in that file is Disable model block rendering.

When building the language files, the substring {config.model_block.model_block_disable_rendering} will be replaced with its value "Disable model block rendering". Note that the value will be put in double quotes.

Formatting

The .lang files under src/main/ressources/assets/blockbuster/lang use Minecraft's formatting code, which is specified here minecraft.fandom.com/wiki/Formatting_codes. However, in the yaml files, you need to put the characters or digits of Minecraft's formatting in curly braces and omit the § character.

Example:

Minecraft's formatting §c, which would format the text red, needs to be {c} in the .yml files, omitting the § character.

Dynamic Arguments

The character sequence %s denotes that there will be a String argument dynamically placed at runtime.

For example, dimensions: "Size (%spx, %spx)" means that at runtime the message can be Size (12px, 33px) or Size (2px, 55px), where the %s can take any String value. For the specific java implementation, checkout www.baeldung.com/string/format. When translating, take this into account, for example, you should not remove these and you should watch out for the sentence order with these arguments.

Comparing the language files

The script build.gradle has a task to compare the .lang files under src/main/ressources/assets/blockbuster/lang/. You may want to build the language files first using the command gradlew buildLangFiles. Then you can compare the language files with the command gradlew compareLangFiles. This command will output all the missing or additional keys in the respective lang files, compared to en_US.lang.

How to read the output:

Example:

Language file zh_TW.lang misses following keys:
- blockbuster.gui.image.remove_parent_space_effects
- item.blockbuster.model.name

The file help/zh_TW/gui.yml misses the key image.remove_parent_space_effects. Tip: things like item.blockbuster.model.name are probably located in the respective vanilla.yml file. If you are not sure, search for the key in the yaml files under help/en_US/, as these files are complete.

Clone this wiki locally