Skip to content

Class: I18nHelper

Localization related helper functions for i18n.

Hierarchy

  • I18nHelper

Summary

Methods

Methods

Static getDefinition

getDefinition(languageCode: string, stringSource: LocalizationStringSource, localizationFolder: string): any

This method is to get definition

Parameters:

Name Type Default Description
languageCode string - language code
stringSource LocalizationStringSource LocalizationStringSource.Bundle localization string source
localizationFolder string "" -

Returns: any

definition


Static getI18nStringReference

getI18nStringReference(languageCode: string, localizationStringRef: string): string[]

This method is to generate strings file name based on selected language code

Parameters:

Name Type Description
languageCode string language code
localizationStringRef string default localization string reference

Returns: string[]

returns localization full reference path on first index and localization file name on second index


Static getLocalizableKey

getLocalizableKey(value: string): string

This method is to get the key of a localizable strings

Parameters:

Name Type Description
value string value with localizable indicator

Returns: string

key of localizable strings


Static localizeDefinitionText

localizeDefinitionText(key: string, dynamicParams?: string[], context?: IContext): string

This method is to localize definition text and its dynamic parameters if any

Parameters:

Name Type Description
key string key of text to be localized
dynamicParams? string[] dynamic parameters (optional)
context? IContext context for binding

Returns: string

localized text


Static localizeExtensionText

localizeExtensionText(key: string, localizationFolder?: string, dynamicParams?: string[], context?: IContext): string

This method is to localize extension text and its dynamic parameters if any

Parameters:

Name Type Description
key string key of text to be localized
localizationFolder? string folder that contains the extension module's localization resource files (optional)
dynamicParams? string[] dynamic parameters (optional)
context? IContext context for binding (optional)

Returns: string

localized text


Static localizeMDKText

localizeMDKText(key: string, dynamicParams?: string[], context?: IContext): string

This method is to localize MDK text and its dynamic parameters if any

Parameters:

Name Type Description
key string key of text to be localized
dynamicParams? string[] dynamic parameters (optional)
context? IContext context for binding (optional)

Returns: string

localized text


Static parseLocalizableString

parseLocalizableString(value: string, context: IContext): string

This method is to parse localizable string with localizable type indicator specified $(type,...)

Parameters:

Name Type Default Description
value string - value with localizable indicator
context IContext ContextFromPage() context to be used for parsing binding

Returns: string

localized or formatted text