Class LocalizationBuilder
java.lang.Object
com.tccc.kos.commons.core.localization.LocalizationBuilder
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder for a locale within aNamespaceBuilder
.static class
Builder for a namespace within aLocalizationBuilder
. -
Constructor Summary
ConstructorsConstructorDescriptionCreate empty builder that can be used to manually create localization information that can be added to aLocalizationContext
.Create a builder that is populate from the localization descriptor in the specified kab. -
Method Summary
Modifier and TypeMethodDescriptionaddNamespace
(String name) Add a namespace to the builder.Return the namespaces in the builder.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.
-
Constructor Details
-
LocalizationBuilder
public LocalizationBuilder()Create empty builder that can be used to manually create localization information that can be added to aLocalizationContext
. -
LocalizationBuilder
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
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
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
-