Search results

L10n API in JavaScript Base API control

L10n modules provides localized text for different culture.

import {setCulture} from '@syncfusion/ts-base-library';
//load global locale object common for all components.
L10n.load({
   'fr-BE': {
      'button': {
           'check': 'vérifié'
       }
   }
});
//set globale default locale culture.
setCulture('fr-BE');
let instance: L10n = new L10n('button', {
   check: 'checked'
});
//Get locale text for current property.
instance.getConstant('check');
//Change locale culture in a component.
instance.setLocale('en-US');

Methods

getConstant

Returns current locale text for the property based on the culture name and control name.

Parameter Type Description
prop string specifies the property for which localize text to be returned.

Returns string

setLocale

Sets the locale text

Parameter Type Description
locale string ?

Returns void

load

Sets the global locale for all components.

Parameter Type Description
localeObject Object specifies the localeObject to be set as global locale.

Returns void