Interface: ILocalizationEngine
The form localization engine.
Properties
language
language:
`${string}-${string}`
The current language.
testLocalization()?
optionaltestLocalization: (localization,localizationStringId,language,formData) =>string|LocalizationError[]
Tests localization by formatting a message with given data.
Parameters
localization
string
the localization string to test.
localizationStringId
string
the ID of the localization string.
language
the language for the test.
formData
the data to use for variable substitution.
Returns
string | LocalizationError[]
the array of errors or the formatted result string.
Methods
addMessages()
addMessages(
locale,messages):LocalizationError[]
Adds messages to the localization engine.
Parameters
locale
string
the locale for the messages.
messages
Record<string, string>
the messages to add.
Returns
the array of any localization errors that occurred.
getCompatibleId()
getCompatibleId(
rawId):string
Gets a compatible ID for localization engine.
Parameters
rawId
string
the raw ID to make compatible.
Returns
string
the compatible ID.
localizeErrorMessage()
localizeErrorMessage(
form,formData,language,componentStore,ruleKey):undefined|string
Localizes error messages for validation rules.
Parameters
form
the form containing localization data.
formData
the form data for variable substitution.
language
the target language for localization.
componentStore
the component store to localize.
ruleKey
string
the validation rule key.
Returns
undefined | string
the localized error message or undefined.
localizeProperties()
localizeProperties(
form,formData,language,componentStore,type?):Record<string,any>
Localizes properties for a component.
Parameters
form
the form containing localization data.
formData
the form data for variable substitution.
language
the target language for localization.
componentStore
the component store to localize.
type?
string
the type of localization (default: 'component').
Returns
Record<string, any>
the object with localized property values.