Class SwingTranslations

java.lang.Object
org.inspirenxe.strata.swing.SwingTranslations

public final class SwingTranslations extends Object
Sets where translated text comes from in a Swing application. There is one translator for the whole process; until one is set, Strata's own keys read in English and other keys read as themselves. Open panels lay out again on their next frame after a change.
SwingTranslations.use(ResourceBundle.getBundle("shop.messages", Locale.GERMAN));
  • Method Details

    • use

      public static void use(ResourceBundle bundle)
      Translates with a resource bundle. Keys the bundle lacks fall back as if no translator were set. Call this again with another bundle to change the language.

      The bundle's locale becomes the translator's locale, which dates and times follow: month and weekday names, the first day of the week, the order of a date's parts and the 12 or 24 hour clock. A base bundle, whose locale is Locale.ROOT, leaves the JVM's default locale for formatting in place.

      Parameters:
      bundle - the bundle, whose values are patterns with %s, %1$s and %%
    • use

      public static void use(org.inspirenxe.strata.spi.Translator translator)
      Translates with any translator, such as one that reads a different file format. The translator must follow the Translator contract: it may be called from any thread, and its version must change whenever what it returns may.
      Parameters:
      translator - the translator