Files
NapCatQQ/.pnpm-store/v3/files/e8/c2c962ecb31c4fa5a241e9ba483659911fcc57717fef01015e727fe9671c7603ef9405786251858870f9e9ae79a78181613b4b797cfd2493a195fccadc7125
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

59 lines
2.5 KiB
Plaintext

function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "LocalizedStringFormatter", () => $3e95fbf3429967d1$export$2f817fcdc4b89ae0);
/*
* Copyright 2022 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/ const $3e95fbf3429967d1$var$pluralRulesCache = new Map();
const $3e95fbf3429967d1$var$numberFormatCache = new Map();
class $3e95fbf3429967d1$export$2f817fcdc4b89ae0 {
/** Formats a localized string for the given key with the provided variables. */ format(key, variables) {
let message = this.strings.getStringForLocale(key, this.locale);
return typeof message === 'function' ? message(variables, this) : message;
}
plural(count, options, type = 'cardinal') {
let opt = options['=' + count];
if (opt) return typeof opt === 'function' ? opt() : opt;
let key = this.locale + ':' + type;
let pluralRules = $3e95fbf3429967d1$var$pluralRulesCache.get(key);
if (!pluralRules) {
pluralRules = new Intl.PluralRules(this.locale, {
type: type
});
$3e95fbf3429967d1$var$pluralRulesCache.set(key, pluralRules);
}
let selected = pluralRules.select(count);
opt = options[selected] || options.other;
return typeof opt === 'function' ? opt() : opt;
}
number(value) {
let numberFormat = $3e95fbf3429967d1$var$numberFormatCache.get(this.locale);
if (!numberFormat) {
numberFormat = new Intl.NumberFormat(this.locale);
$3e95fbf3429967d1$var$numberFormatCache.set(this.locale, numberFormat);
}
return numberFormat.format(value);
}
select(options, value) {
let opt = options[value] || options.other;
return typeof opt === 'function' ? opt() : opt;
}
constructor(locale, strings){
this.locale = locale;
this.strings = strings;
}
}
//# sourceMappingURL=LocalizedStringFormatter.main.js.map