Class 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 Detail

      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • 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:
        Constant Field Values
      • CHECK_REPORT_NO_PROBLEMS

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

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

      • ModelLocalisation

        public ModelLocalisation()
    • Method Detail

      • 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.