Skip to content
Leo edited this page Jan 26, 2024 · 5 revisions

Welcome to the Translations Framework wiki!

The Translations Framework is a tool to handle localization for your Minecraft plugins. It creates and parses language files into usable Components of the popular Adventure Component API. One core feature is a shared global language directory, that allows you to simply created shared translations for multiple plugins.

This looks like the following: at the start, there is just the global Translations instance. Each application can either fork from the global instance or another translations instance. The result is a tree like structure of Translation instances, which will each use all language files and all styles from all direct and indirect predecessors in the tree.

/Server
  /plugins
    
    /lang
      global_styles.properties # <--- global styling rules
      en-US.properties # <--- global messages (like the server name)
    
    /YourPlugin
      /lang
        styles.properties # <--- application only styles
        en-US.properties # <--- application only messages
# A collection of styles that can be used in all successing Translations instances
text_light="<brighter><text>{slot}</text></brighter>"
text="<gray>{slot}</gray>"
text_dark="<darker><text>{slot}</text></darker>"

The framework turns each entry of the according locale files into Message objects. A Message implements the ComponentLike class and can therefore be used as simple Component. To resolve a message into a Component, it MUST be registered at a Translation instance, which is responsible for resolving all tags and placeholders.

Translations can be used as runtime only, but in most cases, you might want to combine a Translations instance with a Message storage of any type. Message storages load localized messages from files (properties, yml, sql, crowdin, ...) and provide them in the proper context.