Class LabelRegistry

java.lang.Object
tools.pantheum.gaia.gs1.localization.LabelRegistry

public final class LabelRegistry extends Object
Localized display labels for interpretation segments, keyed by the interpretation type (e.g. "GTIN_TYPE", "CHECK_DIGIT").

Each supported language ships a JSON catalogue under /localization/<LANG>/ mapping the interpretation type to its human-readable label. English (interpretation_labels_EN.json) is the canonical, complete catalogue and the fallback for any type missing from another language's catalogue. The loader is fail-open: a catalogue file that is absent or malformed yields an empty map, so the English fallback (and ultimately the label the producer emitted) still applies.

Loaded lazily per language and cached; thread-safe.

See Also:
  • Field Details

    • INSTANCE

      public static final LabelRegistry INSTANCE
      The singleton instance.
  • Method Details

    • labelFor

      public String labelFor(String type, GaiaConstants.Language language)
      Returns the localized label for the given interpretation type, or null if the type is not catalogued in the requested language or in English. Callers should treat null as "keep the label the producer already supplied".
      Parameters:
      type - the interpretation type (its key), e.g. "GTIN_TYPE"
      language - the desired language; falls back to English when the language has no catalogue, or the type is missing from its catalogue
      Returns:
      the label for.