Class LocalizationContext

java.lang.Object
com.tccc.kos.commons.core.localization.LocalizationContext
All Implemented Interfaces:
VFSSource

public class LocalizationContext extends Object implements VFSSource
A context to facilitate the aggregation of language files that are packaged in kabs using a standard LocalizationDescriptorFragment in a kab descriptor. The context will merge all the described namespaces together and manage a VFS view of the aggregated language data suitable for a ui to load.
Version:
2024-03-22
  • Constructor Details

    • LocalizationContext

      public LocalizationContext()
  • Method Details

    • getPath

      public String getPath()
      Return the path to where this is mounted in vfs.
    • add

      public void add(KabFile kab)
      Add a kab to the context. Any localization information in the descriptor will be merged into the context and associated locale files will be mounted into the internal vfs.
      Parameters:
      kab - the kab file to add to the context
    • add

      public void add(LocalizationBuilder builder)
      Add a LocalizationBuilder to the context. Any localization information in the builder will be merged into the context and associated locale files will be mounted into the internal vfs.
      Parameters:
      builder - the builder to add to the context
    • getLocales

      public Collection<String> getLocales()
      Return the list of available locales in the context
    • getInputStream

      public InputStream getInputStream(String path)
      Description copied from interface: VFSSource
      Returns an input stream for the specified path.
      Specified by:
      getInputStream in interface VFSSource
      Parameters:
      path - the requested path
      Returns:
      the input stream or null if not found
    • getDetails

      public JsonViewWrapper getDetails()
      Description copied from interface: VFSSource
      Return details for the json view.
      Specified by:
      getDetails in interface VFSSource
    • isEnabled

      public boolean isEnabled()
      Description copied from interface: VFSSource
      Return true if the source is enabled. Disabled sources will not be accessible.
      Specified by:
      isEnabled in interface VFSSource
    • getParent

      public VFSParent getParent()
      Description copied from interface: VFSSource
      Gets the parent.
      Specified by:
      getParent in interface VFSSource
      Returns:
      the parent
    • setParent

      public void setParent(VFSParent parent)
      Description copied from interface: VFSSource
      Sets the parent.
      Specified by:
      setParent in interface VFSSource