Annotation Type LocalizedProperty


This annotation is used by LocalizationUtils.localizeComponents(Component) to to automatically localize properties of Components - like HasText.setText(String) or TextField.setLabel(String) - stored in the fields of a host object. It can be used on the fields directly or as meta-annotation on other annotations and is repeatable.
  • When property() is empty, the properties to be localized will be determined from the local parts of the messages keys declared at the same location - i.e. on the same field directly or on the same annotation. In that case key() also must be empty.
  • When a property() is set, only the specified property will be localized - unless there are multiple LocalizedProperty.
    • If key() is empty, then it's assumed that a message key with the property name as local part has been declared at the same location.
    • If key() is set, then it's assumed to be a (full) message key that has been declared somewhere else.
  • When used as meta-annotation, the host annotation may also provide a property() or key() attribute. If set they will override the respective value provided in the LocalizedProperty.
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static @interface 
    Container for repeated @LocalizedProperty annotations.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The (full) message key code used to translate the property.
    The name of the property to be translated.
  • Element Details

    • property

      String property
      The name of the property to be translated.

      If empty/not specified, the properties to be localized will be determined from the local parts of message keys declared at the same location (on the same field directly or on the same annotation). In that case key() also must be empty.

      Returns:
      the name of the property to be translated
      Default:
      ""
    • key

      String key
      The (full) message key code used to translate the property. This can be set to reuse message keys that are already declared somewhere else. In that case property() must also be set.
      Returns:
      the (full) message key code used to translate the property
      Default:
      ""