Interface TranslatetoModule

All Superinterfaces:
org.incendo.cloud.execution.CommandExecutionHandler<FPlayer>, ModuleCommand, ModuleLocalization, ModuleSimple

public interface TranslatetoModule extends ModuleCommand
The /translateto command, which translates a message into another language.
  • Method Details

    • config

      Description copied from interface: ModuleCommand
      The config section for this command, which also holds its aliases.
      Specified by:
      config in interface ModuleCommand
      Specified by:
      config in interface ModuleSimple
      Returns:
      the command settings
    • permission

      Description copied from interface: ModuleSimple
      The permission that gates this module.
      Specified by:
      permission in interface ModuleSimple
      Returns:
      the permission
    • localization

      Description copied from interface: ModuleLocalization
      The localization section for a player, picked from their chosen language.
      Specified by:
      localization in interface ModuleLocalization
      Parameters:
      fPlayer - the player the text is for
      Returns:
      the localization settings
    • replaceLanguage

      String replaceLanguage(FPlayer fPlayer, String targetLang)
      The display name of a language in the reader's own language.
      Parameters:
      fPlayer - the reader
      targetLang - the language code
      Returns:
      the language name
    • translate

      String translate(FPlayer fPlayer, String source, String target, String text)
      Translates text using whichever translation integration is enabled.
      Parameters:
      fPlayer - who asked
      source - the language to translate from, or an empty string to detect it
      target - the language to translate into
      text - the text
      Returns:
      the translation, or the original text if no service could do it
    • googleTranslate

      String googleTranslate(String source, String lang, String text)
      Translates text through Google, the fallback when no integration is configured.
      Parameters:
      source - the language to translate from
      lang - the language to translate into
      text - the text
      Returns:
      the translation, or the original text on failure