Class I18nModule

All Implemented Interfaces:
CommandOwner

public class I18nModule extends JavaPlugin
  • Field Details

  • Constructor Details

  • Method Details

    • get

      public static I18nModule get()
    • getUpdatePacketsForChanges

      @Nonnull public UpdateTranslations[] getUpdatePacketsForChanges(String languageKey, @Nonnull Map<String, Map<String,String>> changed, @Nonnull Map<String, Map<String,String>> removed)
    • getMessages

      @Nonnull public Map<String,String> getMessages(@Nullable String language)
    • resolveLanguage

      @Nonnull public String resolveLanguage(@Nullable String language)
      Resolves the given language identifier to one defined and recognized by the loaded message sets. If the language identifier is unrecognized, does not have a fallback, the fallback is unrecognized, or the identifier is null, the default language is used.
      Parameters:
      language - Language identifier
      Returns:
      The nearest language identifier supported by the module.
    • getMessages

      public Map<String,String> getMessages(@Nonnull Map<String, Map<String,String>> languageMap, @Nullable String language)
    • sendTranslations

      public void sendTranslations(@Nonnull PacketHandler packetHandler, String language)
    • queueTranslations

      public void queueTranslations(@Nonnull PacketHandler packetHandler, @Nonnull String language)
      Queues the translation catalog of a language for a connection. The queued language replaces the one queued before it, and the flush task sends the last one. The flush task also drops the connections that closed, so an entry lives for one interval.
      Parameters:
      packetHandler - The connection to send the catalog to.
      language - The language to send the catalog for.
    • getMessage

      @Nullable public String getMessage(String language, @Nonnull String key)