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

@kotori-bot/i18n

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@kotori-bot/i18n - npm Package Compare versions

Comparing version 1.3.1 to 1.3.2

1

dist/common.d.ts

@@ -18,2 +18,3 @@ import LocaleIdentifier from './types/locale';

locale(locale: string, lang?: T): string;
t(raw: TemplateStringsArray): string;
set(lang: T): void;

@@ -20,0 +21,0 @@ get(): T;

15

dist/common.js
/**
* @Package @kotori-bot/i18n
* @Version 1.3.1
* @Author Hotaru <biyuehuya@gmail.com>
* @Version 1.3.2
* @Author Hotaru <me@hotaru.icu>
* @Copyright 2024 Hotaru. All rights reserved.
* @License GPL-3.0
* @Link https://github.com/kotorijs/kotori
* @Date 2024/6/7 11:22:21
* @Date 2024/8/8 20:53:56
*/

@@ -58,8 +58,6 @@

this.lang = config.lang;
this.supports.forEach((locale) => this.localesData.set(locale, /* @__PURE__ */ new Map()));
for (const locale of this.supports) this.localesData.set(locale, /* @__PURE__ */ new Map());
}
use(locales, lang = this.lang) {
Object.keys(locales).forEach((locale) => {
this.localesData.get(lang).set(locale.toLowerCase(), locales[locale]);
});
for (const locale in locales) this.localesData.get(lang)?.set(locale.toLowerCase(), locales[locale]);
}

@@ -69,2 +67,5 @@ locale(locale, lang = this.lang) {

}
t(raw) {
return this.locale(raw.join(""));
}
set(lang) {

@@ -71,0 +72,0 @@ this.lang = lang;

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

import { LocaleType } from './common';
import type { LocaleType } from './common';
export declare const DEFAULT_SUPPORTS: ("en_US" | "en_GB" | "en_AU" | "zh_CN" | "zh_HK" | "zh_TW" | "zh_SG" | "es_ES" | "es_MX" | "ar_EG" | "ar_AE" | "ru_RU" | "fr_FR" | "fr_CA" | "de_DE" | "de_CH" | "it_IT" | "it_CH" | "hi_IN" | "pt_BR" | "pt_PT" | "tr_TR" | "ja_JP" | "id_ID" | "uk_UA" | "vi_VN" | "th_TH" | "sv_SE" | "nb_NO" | "da_DK" | "fi_FI" | "he_IL" | "sk_SK" | "bg_BG" | "lt_LT" | "sl_SI" | "sr_RS" | "mk_MK" | "sq_AL" | "et_EE" | "mt_MT" | "common")[];
export declare const DEFAULT_LANG: LocaleType;
export declare const DEFAULT_EXT = ".json";
/**
* @Package @kotori-bot/i18n
* @Version 1.3.1
* @Author Hotaru <biyuehuya@gmail.com>
* @Version 1.3.2
* @Author Hotaru <me@hotaru.icu>
* @Copyright 2024 Hotaru. All rights reserved.
* @License GPL-3.0
* @Link https://github.com/kotorijs/kotori
* @Date 2024/6/7 11:22:21
* @Date 2024/8/8 20:53:56
*/

@@ -11,0 +11,0 @@

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

import { I18n as I18nCommon, LocaleType, localeData } from './common';
import { I18n as I18nCommon, type LocaleType, type localeData } from './common';
export * from './common';

@@ -3,0 +3,0 @@ export declare class I18n<T extends LocaleType = LocaleType> extends I18nCommon<T> {

/**
* @Package @kotori-bot/i18n
* @Version 1.3.1
* @Author Hotaru <biyuehuya@gmail.com>
* @Version 1.3.2
* @Author Hotaru <me@hotaru.icu>
* @Copyright 2024 Hotaru. All rights reserved.
* @License GPL-3.0
* @Link https://github.com/kotorijs/kotori
* @Date 2024/6/7 11:22:21
* @Date 2024/8/8 20:53:56
*/

@@ -45,5 +45,5 @@

loader(dir) {
this.supports.forEach((lang) => {
for (const lang of this.supports) {
const file = (0, import_node_path.join)(dir, `${lang}${this.ext}`);
if (!(0, import_node_fs.existsSync)(file)) return;
if (!(0, import_node_fs.existsSync)(file)) continue;
try {

@@ -55,3 +55,3 @@ const locales = JSON.parse((0, import_node_fs.readFileSync)(file).toString());

}
});
}
}

@@ -58,0 +58,0 @@ constructor(config = { lang: import_const.DEFAULT_LANG }) {

/**
* @Package @kotori-bot/i18n
* @Version 1.3.1
* @Author Hotaru <biyuehuya@gmail.com>
* @Version 1.3.2
* @Author Hotaru <me@hotaru.icu>
* @Copyright 2024 Hotaru. All rights reserved.
* @License GPL-3.0
* @Link https://github.com/kotorijs/kotori
* @Date 2024/6/7 11:22:21
* @Date 2024/8/8 20:53:56
*/

@@ -11,0 +11,0 @@

{
"name": "@kotori-bot/i18n",
"version": "1.3.1",
"version": "1.3.2",
"description": "i18n For Kotori",

@@ -8,3 +8,3 @@ "main": "dist/index.js",

"license": "GPL-3.0",
"author": "Hotaru <biyuehuya@gmail.com>",
"author": "Hotaru <me@hotaru.icu>",
"keywords": [

@@ -11,0 +11,0 @@ "kotori",

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