To make components Internationalize you can use Internationalization Properties in Salesforce as shown below
import internationalizationPropertyName from @salesforce/i18n/internationalizationProperty;
The Property values will be returned for current user.
1.Internationalize Locale Date
ex:
import LOCALE from "@salesforce/i18n/locale";
@track date = new Date(2022, 6, 25);
@track formattedDate;
this.formattedDate = new Intl.DateTimeFormat(LOCALE).format(this.date);
2.Internationalize Currency
ex:
import LOCALE from "@salesforce/i18n/locale";
import CURRENCY from "@salesforce/i18n/currency";
@track number = 10050.5;
@track formattedCurrency;
this.formattedCurrency = new Intl.NumberFormat(LOCALE, {
style: "currency",
currency: CURRENCY,
currencyDisplay: "symbol"
}).format(this.number);
3.Internationalize Time Zone
ex :
import TIMEZONE from "@salesforce/i18n/timeZone";
@track timeZone;
this.timeZone = TIMEZONE;
No comments:
Post a Comment