Work In Progress
This documentation is in beta. It's missing lots of content, search is broken, and many links go nowhere. These problems will be fixed before release, but there's plenty of work left!
Skip to main content

Registries

The framework includes a set of registries it uses to look various pieces of data. While you shouldn't need to interact with these registries yourself in most instances, they may be helpful for addressing a handful of advanced use-cases, so we've documented some of them here.

Class-Loader Registry

The ClassLoaderRegistry is in charge of keeping track of which class-loaders should be used to load your project's translation bundles. While this is mostly handled automatically, it can be helpful to customise this behaviour if you're using, for example, a complicated plugin system.

getCallbackClassloaders(...)Returns:Map<String, ClassLoader>

Call all registered class-loader callbacks, returning a map containing the resolved class-loaders.

The map's keys are strings representing each class-loader's name.

getForBundle(...)Returns:ClassLoader

Look up a specific translation bundle, and retrieve the correct class-loader used to load translations from that bundle.

This will be the system class-loader if the bundle doesn't define a more specific one.

Arguments
bundleTypes:BundleString

The bundle to look up, either by name or using the object itself.

register(...)Returns:Boolean

Register a custom class-loader callback.

These callbacks take the form of a lambda of the type () -> Map&lt;String, ClassLoader&gt;. You can also call this function like a builder, if you prefer.

Arguments
callbackType: () -> Map<String, ClassLoader>

The class-loader callback to register.

This callback must return a mapping of class-loader names to class-loaders.