Class LocalizationBuilder

java.lang.Object
com.tccc.kos.commons.core.localization.LocalizationBuilder

public class LocalizationBuilder extends Object
Builder for constructing localization data from a KAB when the KAB doesn't contain a standard localization fragment in the descriptor.
Version:
2024-04-27
  • Constructor Details

    • LocalizationBuilder

      public LocalizationBuilder()
      Create empty builder that can be used to manually create localization information that can be added to a LocalizationContext .
    • LocalizationBuilder

      public LocalizationBuilder(KabFile kab)
      Create a builder that is populate from the localization descriptor in the specified kab. If there is no descriptor then this builder will remain empty.
      Parameters:
      kab - the kab to populate the builder with
  • Method Details

    • setDefaultLocale

      public LocalizationBuilder setDefaultLocale(String defaultLocale)
      Set the default locale for all the translations in the builder following IETF BCP 47 standards using ISO 639 alpha2 language codes and optional ISO 3166 alpha2 country codes. These standard dictate lower case language codes, upper case country codes and a dash separator. kOS will accommodate underscores as a common alternative.
    • addNamespace

      public LocalizationBuilder.NamespaceBuilder addNamespace(String name)
      Add a namespace to the builder. If the namespace already exists, the existing namespace builder will be returned.
      Parameters:
      name - name of the namespace
    • getNamespaces

      Return the namespaces in the builder.
    • getDefaultLocale

      public String getDefaultLocale()