Files
NapCatQQ/.pnpm-store/v3/files/1c/3ea830c90f529d4a3ad3794f3ef56fbd33e0c07aaf9e07d59603cc341838beefe1c74109d3d811e590d68aa785a343a602ae0a19ebb58a482631e67bd254e5
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

49 lines
1.9 KiB
Plaintext

var $f4V3v$intlmessageformat = require("intl-messageformat");
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
$parcel$export(module.exports, "MessageFormatter", () => $7a31ee9993c13f0b$export$526ebc05ff964723);
/*
* Copyright 2020 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.
*/
class $7a31ee9993c13f0b$export$526ebc05ff964723 {
format(key, variables) {
let message = this.cache[key];
if (!message) {
let msg = this.messages.getStringForLocale(key, this.locale);
if (!msg) throw new Error(`Could not find intl message ${key} in ${this.locale} locale`);
message = new (0, ($parcel$interopDefault($f4V3v$intlmessageformat)))(msg, this.locale);
this.cache[key] = message;
}
let varCopy;
if (variables) varCopy = Object.keys(variables).reduce((acc, key)=>{
acc[key] = variables[key] == null ? false : variables[key];
return acc;
}, {});
return message.format(varCopy);
}
constructor(locale, messages){
this.locale = locale;
this.messages = messages;
this.cache = {};
}
}
//# sourceMappingURL=MessageFormatter.main.js.map