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

@daldalso/i18n

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@daldalso/i18n - npm Package Compare versions

Comparing version 0.9.0 to 0.9.1

8

dist/core.d.ts

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

import React from "react";
import { type Context, type Lexicon, ModuleLoader } from "./types";
import type { ModuleLoader } from "./types";
import { type Lexicon } from "./types";
export default class I18n {
static context: React.Context<Context>;
static initialized: boolean;
static get lexiconPrefixes(): string[];

@@ -10,3 +8,3 @@ private static readonly loadedLexicons;

static initialize(moduleLoader: ModuleLoader): Promise<void>;
static useContext(...lexicons: Lexicon[]): Context;
static loadLexicons(...lexicons: Lexicon[]): void;
static register<const T extends Lexicon>(lexicon: T): T;

@@ -13,0 +11,0 @@ static retrieve(key: string, args: any[]): any;

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

}
static useContext(...lexicons) {
static loadLexicons(...lexicons) {
const tasks = [];

@@ -56,5 +56,5 @@ for (const v of lexicons) {

if (tasks.length) {
// eslint-disable-next-line @typescript-eslint/only-throw-error
throw Promise.all(tasks);
}
return {};
}

@@ -83,4 +83,3 @@ static register(lexicon) {

}
I18n.initialized = false;
I18n.loadedLexicons = new Map();
exports.default = I18n;

@@ -15,5 +15,4 @@ import type { ReactNode } from "react";

export type LFunction<T extends readonly Lexicon[]> = <K extends T extends readonly [] ? never : Extract<keyof MergedLexicon<T>, string>>(...args: MergedLexicon<T>[K] extends (...args: infer R) => any ? [key: K, ...args: R] : [key: K]) => MergedLexicon<T>[K] extends (...args: any) => infer R ? R : MergedLexicon<T>[K];
export type Context = {};
export type I18nInitializerProps = {
locale: string;
};

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

const useLexicon = (...lexicons) => {
core_1.default.useContext(...lexicons);
core_1.default.loadLexicons(...lexicons);
const l = (0, react_1.useCallback)((key, ...args) => core_1.default.retrieve(key, args), []);

@@ -12,0 +12,0 @@ return { l };

{
"name": "@daldalso/i18n",
"version": "0.9.0",
"version": "0.9.1",
"description": "Yet another internationalization library for React.js",

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

"watch": "tsc -w",
"build": "tsc"
"build": "tsc",
"lint": "eslint ./src"
},

@@ -27,3 +28,5 @@ "files": [

"devDependencies": {
"@daldalso/eslint-plugin": "^1.2.3",
"@types/react": "^18.3.3",
"eslint": "^9.9.0",
"typescript": "^5.5.4"

@@ -30,0 +33,0 @@ },

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