зеркало из https://github.com/telerik/kendo-intl.git
Symbol fallback (#129)
* fix(currency): symbol fallback * test(currency): add case for lang/locale pair without explicit symbol
This commit is contained in:
Родитель
64db9ef9f7
Коммит
d2286da466
|
@ -112,7 +112,7 @@ export function currencyDisplay(locale, options) {
|
|||
let result;
|
||||
|
||||
if (currencyDisplay === SYMBOL) {
|
||||
result = currencyInfo["symbol-alt-narrow"] || currencyInfo[SYMBOL];
|
||||
result = currencyInfo["symbol-alt-narrow"] || currencyInfo[SYMBOL] || currency;
|
||||
} else {
|
||||
if (typeof value === "undefined" || value !== 1) {
|
||||
result = currencyInfo["displayName-count-other"];
|
||||
|
|
|
@ -6,7 +6,10 @@ const numbers = require("cldr-numbers-full/main/bg/numbers.json");
|
|||
const currencies = require("cldr-numbers-full/main/bg/currencies.json");
|
||||
const currencyData = require("cldr-core/supplemental/currencyData.json");
|
||||
|
||||
load(likelySubtags, currencyData, numbers, currencies);
|
||||
const localNumbers = require("cldr-numbers-full/main/de-CH/numbers.json");
|
||||
const localCurrencies = require("cldr-numbers-full/main/de-CH/currencies.json");
|
||||
|
||||
load(likelySubtags, currencyData, numbers, currencies, localNumbers, localCurrencies);
|
||||
|
||||
function loadCustom(options) {
|
||||
load({
|
||||
|
@ -300,6 +303,10 @@ describe('standard currency formatting', () => {
|
|||
expect(formatNumber(10, "c", "bg-BG")).toEqual("10,00 лв.");
|
||||
});
|
||||
|
||||
it("should apply format when passing language and territory without symbol", () => {
|
||||
expect(formatNumber(10, "c", "de-CH")).toEqual("CHF 10.00");
|
||||
});
|
||||
|
||||
it("should apply format when passing object", () => {
|
||||
expect(formatNumber(10, { style: "currency" })).toEqual("$10.00");
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче