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.2.1 to 1.3.0

2

dist/common.js

@@ -40,3 +40,3 @@ "use strict";

locale(locale, lang = this.lang) {
return this.localesData.get(lang).get(locale) ?? locale;
return this.localesData.get(lang)?.get(locale) ?? this.localesData.get('common')?.get(locale) ?? locale;
}

@@ -43,0 +43,0 @@ set(lang) {

import { 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")[];
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";

@@ -18,4 +18,4 @@ "use strict";

exports.I18n = void 0;
const fs_1 = require("fs");
const path_1 = require("path");
const node_fs_1 = require("node:fs");
const node_path_1 = require("node:path");
const common_1 = require("./common");

@@ -28,8 +28,8 @@ const const_1 = require("./const");

this.supports.forEach((lang) => {
const file = (0, path_1.join)(dir, `${lang}${this.ext}`);
if (!(0, fs_1.existsSync)(file))
const file = (0, node_path_1.join)(dir, `${lang}${this.ext}`);
if (!(0, node_fs_1.existsSync)(file))
return;
try {
const locales = JSON.parse((0, fs_1.readFileSync)(file).toString());
this.use(locales, lang);
const locales = JSON.parse((0, node_fs_1.readFileSync)(file).toString());
super.use(locales, lang);
}

@@ -46,9 +46,5 @@ catch {

use(locales, lang = this.lang) {
if (typeof locales === 'string') {
this.loader(locales);
return;
}
Object.keys(locales).forEach((locale) => {
this.localesData.get(lang).set(locale, locales[locale]);
});
if (typeof locales === 'string')
return this.loader(locales);
return super.use(locales, lang);
}

@@ -55,0 +51,0 @@ }

@@ -42,4 +42,5 @@ export declare enum LocaleIdentifier {

et_EE = "et-EE",
mt_MT = "mt-MT"
mt_MT = "mt-MT",
common = "COMMON"
}
export default LocaleIdentifier;

@@ -47,3 +47,4 @@ "use strict";

LocaleIdentifier["mt_MT"] = "mt-MT";
LocaleIdentifier["common"] = "COMMON";
})(LocaleIdentifier || (exports.LocaleIdentifier = LocaleIdentifier = {}));
exports.default = LocaleIdentifier;
{
"name": "@kotori-bot/i18n",
"version": "1.2.1",
"version": "1.3.0",
"description": "i18n For Kotori",

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

},
"homepage": "https://kotori.js.org",
"scripts": {
"build": "tsc --build"
}
"homepage": "https://kotori.js.org"
}

@@ -24,3 +24,3 @@ # @kotori-bot/i18n

```typescript
import I18n from 'i18n';
import I18n from '@kotori-bot/i18n';

@@ -27,0 +27,0 @@ const i18n = new I18n();

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