@markuplint/i18n
Advanced tools
Comparing version 3.5.0 to 3.6.0
@@ -6,2 +6,4 @@ import type { LocaleSet, Primitive, Translator } from './types'; | ||
*/ | ||
export declare function taggedTemplateTranslator(localeSet?: LocaleSet): (strings: Readonly<TemplateStringsArray>, ...keys: readonly Primitive[]) => string; | ||
export declare function taggedTemplateTranslator( | ||
localeSet?: LocaleSet, | ||
): (strings: Readonly<TemplateStringsArray>, ...keys: readonly Primitive[]) => string; |
@@ -11,6 +11,6 @@ "use strict"; | ||
return (messageTmpl, ...keywords) => { | ||
var _a; | ||
var _a, _b; | ||
let message = messageTmpl; | ||
if (typeof messageTmpl !== 'string') { | ||
const format = (localeSet === null || localeSet === void 0 ? void 0 : localeSet.listFormat) || defaultListFormat; | ||
const format = (_a = localeSet === null || localeSet === void 0 ? void 0 : localeSet.listFormat) !== null && _a !== void 0 ? _a : defaultListFormat; | ||
return `${format.quoteStart}${messageTmpl | ||
@@ -26,3 +26,3 @@ .map(keyword => translateKeyword(keyword, '', localeSet)) | ||
const key = removeNoTranslateMark(messageTmpl).toLowerCase(); | ||
const sentence = (_a = localeSet === null || localeSet === void 0 ? void 0 : localeSet.sentences) === null || _a === void 0 ? void 0 : _a[key]; | ||
const sentence = (_b = localeSet === null || localeSet === void 0 ? void 0 : localeSet.sentences) === null || _b === void 0 ? void 0 : _b[key]; | ||
messageTmpl = sentence !== null && sentence !== void 0 ? sentence : key; | ||
@@ -29,0 +29,0 @@ messageTmpl = |
export type Translator = (messageTmpl: string | readonly string[], ...keywords: readonly Primitive[]) => string; | ||
export type LocaleSet = { | ||
readonly locale: string; | ||
readonly listFormat?: ListFormat; | ||
readonly keywords?: LocalesKeywords; | ||
readonly sentences?: LocalesKeywords; | ||
readonly locale: string; | ||
readonly listFormat?: ListFormat; | ||
readonly keywords?: LocalesKeywords; | ||
readonly sentences?: LocalesKeywords; | ||
}; | ||
export type ListFormat = { | ||
readonly quoteStart: string; | ||
readonly quoteEnd: string; | ||
readonly separator: string; | ||
readonly quoteStart: string; | ||
readonly quoteEnd: string; | ||
readonly separator: string; | ||
}; | ||
export type Primitive = string | number | boolean; | ||
export type LocalesKeywords = { | ||
readonly [messageId: string]: string; | ||
readonly [messageId: string]: string; | ||
}; |
{ | ||
"name": "@markuplint/i18n", | ||
"version": "3.5.0", | ||
"version": "3.6.0", | ||
"description": "HTML parser for markuplint", | ||
@@ -21,3 +21,3 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
}, | ||
"gitHead": "0c47b2c2722f6823a17f36edbab98486275f8ab4" | ||
"gitHead": "715dd53d3b1064a9bcf616c1533921cad9e3b187" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34045
688