Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@markuplint/i18n

Package Overview
Dependencies
Maintainers
1
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@markuplint/i18n - npm Package Compare versions

Comparing version 3.9.0 to 4.0.0-alpha.1

lib/cjs/index.d.ts

4

lib/index.d.ts

@@ -1,2 +0,2 @@

export { translator } from './translator';
export { Translator, LocaleSet } from './types';
export { translator } from './translator.js';
export { Translator, LocaleSet } from './types.js';

@@ -1,5 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.translator = void 0;
var translator_1 = require("./translator");
Object.defineProperty(exports, "translator", { enumerable: true, get: function () { return translator_1.translator; } });
export { translator } from './translator.js';

@@ -1,2 +0,2 @@

import type { LocaleSet, Primitive, Translator } from './types';
import type { LocaleSet, Primitive, Translator } from './types.js';
export declare function translator(localeSet?: LocaleSet): Translator;

@@ -3,0 +3,0 @@ /**

@@ -1,4 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.taggedTemplateTranslator = exports.translator = void 0;
const defaultListFormat = {

@@ -9,8 +6,7 @@ quoteStart: '"',

};
function translator(localeSet) {
export function translator(localeSet) {
return (messageTmpl, ...keywords) => {
var _a, _b;
let message = messageTmpl;
if (typeof messageTmpl !== 'string') {
const format = (_a = localeSet === null || localeSet === void 0 ? void 0 : localeSet.listFormat) !== null && _a !== void 0 ? _a : defaultListFormat;
const format = localeSet?.listFormat ?? defaultListFormat;
return `${format.quoteStart}${messageTmpl

@@ -26,4 +22,4 @@ .map(keyword => translateKeyword(keyword, '', localeSet))

const key = removeNoTranslateMark(messageTmpl).toLowerCase();
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;
const sentence = localeSet?.sentences?.[key];
messageTmpl = sentence ?? key;
messageTmpl =

@@ -36,3 +32,3 @@ removeNoTranslateMark(input.toLowerCase()) === messageTmpl ? removeNoTranslateMark(input) : messageTmpl;

}
const keyword = keywords[num] != null ? toString(keywords[num], localeSet === null || localeSet === void 0 ? void 0 : localeSet.locale) : '';
const keyword = keywords[num] != null ? toString(keywords[num], localeSet?.locale) : '';
// No translate

@@ -47,7 +43,6 @@ if (noTranslateIndex.includes(number)) {

}
exports.translator = translator;
/**
* @experimental
*/
function taggedTemplateTranslator(localeSet) {
export function taggedTemplateTranslator(localeSet) {
const t = translator(localeSet);

@@ -68,5 +63,3 @@ return (strings, ...keys) => {

}
exports.taggedTemplateTranslator = taggedTemplateTranslator;
function translateKeyword(keyword, flag, localeSet) {
var _a, _b;
// No translate

@@ -81,6 +74,5 @@ if (/^%[^%]+%$/.test(keyword)) {

// finding with flag
((_a = localeSet === null || localeSet === void 0 ? void 0 : localeSet.keywords) === null || _a === void 0 ? void 0 : _a[key.toLowerCase()]) ||
(
localeSet?.keywords?.[key.toLowerCase()] ||
// finding without flag
(_b = localeSet === null || localeSet === void 0 ? void 0 : localeSet.keywords) === null || _b === void 0 ? void 0 : _b[keyword.toLowerCase()]);
localeSet?.keywords?.[keyword.toLowerCase()];
return replacedWord || keyword;

@@ -87,0 +79,0 @@ }

@@ -1,2 +0,1 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
export {};
{
"name": "@markuplint/i18n",
"version": "3.9.0",
"description": "HTML parser for markuplint",
"version": "4.0.0-alpha.1",
"description": "Internationalization for markuplint",
"repository": "git@github.com:markuplint/markuplint.git",

@@ -9,4 +9,18 @@ "author": "Yusuke Hirao <yusukehirao@me.com>",

"private": false,
"main": "lib/index.js",
"types": "lib/index.d.ts",
"type": "module",
"exports": {
".": {
"import": "./lib/index.js",
"require": "./lib/cjs/index.js"
},
"./locales/en.json": {
"import": "./locales/en.json",
"require": "./locales/en.json"
},
"./locales/ja.json": {
"import": "./locales/ja.json",
"require": "./locales/ja.json"
}
},
"types": "./lib/index.d.ts",
"publishConfig": {

@@ -19,6 +33,6 @@ "access": "public"

"scripts": {
"build": "tsc",
"build": "tsc; tsc --module commonjs --outDir lib/cjs",
"clean": "tsc --build --clean"
},
"gitHead": "9547b8dca20736a93e4d01af2d61bee314ba5718"
"gitHead": "22502ee22a378ae766033d687dbc0443e5ed35dc"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc