Class Translations

java.lang.Object
com.inet.report.translation.Translations
All Implemented Interfaces:
Serializable

public class Translations extends Object implements Serializable
This class hold the translations and options for translation of a single report (Engine).
Since:
9.1
See Also:
  • Method Details

    • getResourceBundle

      public ResourceBundle getResourceBundle(Locale locale)
      Request a resource bundle for translation the current report. This include the report translations if available else global resources. The resulting ResourceBundle is cascaded. The search order is:
      • saved translations in this report
      • resource bundle of the report
      • global language resource
      Parameters:
      locale - the locale for which a resource bundle is desired, can not be null
      Returns:
      the resource bundle if one find, else null
      Since:
      9.1
    • getTranslation

      public Properties getTranslation(Locale locale)
      Request the property of a translation for the given locale. The locale must match exactly.
      Parameters:
      locale - the locale for which a translation is desired, can not be null
      Returns:
      the properties if one find, else null
      Since:
      9.1
      See Also:
    • setTranslation

      public void setTranslation(Locale locale, Properties props)
      Set a new translation for the current report/engine or remove it. This override an existing translation for the given locale. The translation is saved together with the report file. You can reused the Properties after the call.
      Parameters:
      locale - the locale of the translation
      props - the new key/value pairs. The required keys can be request via Translator.listLabels(boolean). A value of null remove it.
      Since:
      9.1
      See Also:
    • getAvailableLocales

      public List<Locale> getAvailableLocales()
      Get a list of all available translation locales in this report.
      Returns:
      the available locales or an empty list, never null
      Since:
      9.1
      See Also:
    • setUseParagraph

      public void setUseParagraph(boolean useParagraph)
      Set the flag useParagraph. If this flag is set then every paragraph will translate in one step. In the other case every text part of the paragraph will be translate separately. If you translate a paragraph in one step then you need also to set the placeholder for fields and needed formating in the translation.
      Parameters:
      useParagraph - the value of the flag useParagraph.
      Since:
      9.1
      See Also:
    • isUseParagraph

      public boolean isUseParagraph()
      Get the flag useParagraph. This flag control if a paragraph should translate in a single step or every text part separately. This has only an effect if your paragraphs has more then one part (FieldPart or TextPart).
      Returns:
      true, if a paragraph is translate in one step
      Since:
      9.1
      See Also:
    • setResourceBundleName

      public void setResourceBundleName(String name)
      Set an optional ResourceBundle. The bundle must be available in the class path. A separate ResourceBundle give you possibility to use a single ResourceBundle for multiple reports but not the need for all report like the global LanguageResource.
      Parameters:
      name - the base name of the ResourceBundle or null
      Since:
      9.1
      See Also:
    • getResourceBundleName

      public String getResourceBundleName()
      Get the base name of the ResourceBundle
      Returns:
      the name or null
      Since:
      9.1
      See Also: