Class ModelLocalisation

java.lang.Object
de.aristaflow.adept2.model.common.ModelLocalisation

public class ModelLocalisation extends Object
Class for localisation of constant strings in various models (de.aristaflow.adept2.model). These cannot be localised the usual way using resource bundles since we may need all existing localisations for some use cases, e. g. all available localisations of the instance name for a grouping worklist item have to be added to the corresponding plugin data so that the user interface can decide later which one to use.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The index for localisations of check reports listing the elements affected by a check report entry.
    static final int
    The index for localisations of check reports indicating no problems.
    static final int
    The index for localisations of String representation for data type any.
    static final int
    The index for localisations of the instance name for a grouping item.
    static final int
    The index for localisations indicating that a value has not been set.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Map<Locale,String>
    get(int key)
    Gets all available localisation for the designated key.
    static String
    get(Collection<Locale> locales, int key)
    Gets the localisation for the designated locales for the designated key.
    static String
    get(Locale locale, int key)
    Gets the localisation for the designated locale or an appropriate fallback locale for the designated key.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NOT_SET

      public static final int NOT_SET
      The index for localisations indicating that a value has not been set. This is usually for a null value that (obviously) cannot have a localisation.
      See Also:
    • GROUPING_ITEM_INSTANCE_NAME

      public static final int GROUPING_ITEM_INSTANCE_NAME
      The index for localisations of the instance name for a grouping item. This usually refers the reader to the grouped items since their instance names cannot be aggregated.
      See Also:
    • CHECK_REPORT_AFFECTED_ELEMENTS

      public static final int CHECK_REPORT_AFFECTED_ELEMENTS
      The index for localisations of check reports listing the elements affected by a check report entry.
      See Also:
    • CHECK_REPORT_NO_PROBLEMS

      public static final int CHECK_REPORT_NO_PROBLEMS
      The index for localisations of check reports indicating no problems.
      See Also:
    • DATA_TYPE_ANY

      public static final int DATA_TYPE_ANY
      The index for localisations of String representation for data type any.
      See Also:
  • Constructor Details

    • ModelLocalisation

      public ModelLocalisation()
  • Method Details

    • get

      public static String get(Locale locale, int key)
      Gets the localisation for the designated locale or an appropriate fallback locale for the designated key. If no appropriate locale is found or no locale contains a localisation for the designated key, null will be returned.
      Parameters:
      locale - The locale for which to get the localisation (or a fallback locale thereof).
      key - The key for which to get the localisation.
      Returns:
      The localisation for the designated locale or an appropriate fallback locale for the designated key or null if no appropriate locale is found or no locale contains a localisation for the key.
    • get

      public static String get(Collection<Locale> locales, int key)
      Gets the localisation for the designated locales for the designated key. If no locale contains a localisation for the designated key, null will be returned.
      Parameters:
      locales - The locales for which to get the localisation.
      key - The key for which to get the localisation.
      Returns:
      The localisation for the designated locales for the designated key or null if no locale contains a localisation for the key.
    • get

      public static Map<Locale,String> get(int key)
      Gets all available localisation for the designated key. If no locale contains a localisation for the designated key, null will be returned.
      Parameters:
      key - The key for which to get the localisations.
      Returns:
      The localisations for the designated key or null if no locale contains a localisation for the key.