buildRegistryTranslations

abstract fun <T : Any> buildRegistryTranslations(obj: T, prefix: String, lang: String, logWarnings: Boolean, builder: BiConsumer<String, String>)

Applies a set of translations for the provided registry instance to the provided builder. Uses Translatable.Name, Translatable.Desc, and Translatable.Prefix annotations to power the generation. TomlComment and Comment can be used to provide en_us description lang.

This translation only works using an INSTANCE pattern. Kotlin objects, for example. In Java, you will have to define your items, blocks, etc. as member fields in the class and create a static INSTANCE that is referenced wherever.

Author

fzzyhmstrs

Since

0.7.0

Parameters

T

Non-null registry type

obj

T instance to scrape

prefix

String prefix applicable to the registry type. For example, an items registry will use "item". This will create keys like "item.namespace.path"

lang

The applicable lang code to generate for, e.g. "en_us" or "es_mx". The builder will look for annotations with matching codes to apply.

logWarnings

If true, Fzzy Config will log warnings for every missing name, description, and prefix; if false only missing names will be logged.

builder

BiConsumer that accepts new lang entries. For fabric lang generation this could be TranslationBuilder::add