Socket
Socket
Sign inDemoInstall

@lingui/core

Package Overview
Dependencies
Maintainers
3
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lingui/core - npm Package Compare versions

Comparing version 3.17.2 to 4.0.0-next.0

./build/cjs/index.js

23

build/cjs/index.js

@@ -267,4 +267,3 @@ 'use strict';

message,
formats,
context
formats
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

@@ -274,28 +273,18 @@ if (!isString(id)) {

message = id.message;
context = id.context;
id = id.id;
}
const messageMissing = !context && !this.messages[id];
const contextualMessageMissing = context && !this.messages[context][id];
const messageUnreachable = contextualMessageMissing || messageMissing;
const messageMissing = !this.messages[id];
// replace missing messages with custom message for debugging
const missing = this._missing;
if (missing && messageUnreachable) {
return isFunction(missing) ? missing(this._locale, id, context) : missing;
if (missing && messageMissing) {
return isFunction(missing) ? missing(this._locale, id) : missing;
}
if (messageUnreachable) {
if (messageMissing) {
this.emit("missing", {
id,
context,
locale: this._locale
});
}
let translation;
if (context && !contextualMessageMissing) {
// context is like a subdirectory of other keys
translation = this.messages[context][id] || message || id;
} else {
translation = this.messages[id] || message || id;
}
let translation = this.messages[id] || message || id;
if (process.env.NODE_ENV !== "production") {

@@ -302,0 +291,0 @@ translation = isString(translation) ? compile.compileMessage(translation) : translation;

@@ -265,4 +265,3 @@ import { compileMessage } from '@lingui/core/compile';

message,
formats,
context
formats
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

@@ -272,28 +271,18 @@ if (!isString(id)) {

message = id.message;
context = id.context;
id = id.id;
}
const messageMissing = !context && !this.messages[id];
const contextualMessageMissing = context && !this.messages[context][id];
const messageUnreachable = contextualMessageMissing || messageMissing;
const messageMissing = !this.messages[id];
// replace missing messages with custom message for debugging
const missing = this._missing;
if (missing && messageUnreachable) {
return isFunction(missing) ? missing(this._locale, id, context) : missing;
if (missing && messageMissing) {
return isFunction(missing) ? missing(this._locale, id) : missing;
}
if (messageUnreachable) {
if (messageMissing) {
this.emit("missing", {
id,
context,
locale: this._locale
});
}
let translation;
if (context && !contextualMessageMissing) {
// context is like a subdirectory of other keys
translation = this.messages[context][id] || message || id;
} else {
translation = this.messages[id] || message || id;
}
let translation = this.messages[id] || message || id;
if (process.env.NODE_ENV !== "production") {

@@ -300,0 +289,0 @@ translation = isString(translation) ? compileMessage(translation) : translation;

@@ -15,3 +15,2 @@ import { PluralCategory } from 'make-plural';

message?: string;
context?: string;
formats?: Formats;

@@ -38,3 +37,2 @@ };

message?: string;
context?: string;
values?: Record<string, unknown>;

@@ -45,5 +43,4 @@ };

id: string;
context?: string;
};
type MissingHandler = string | ((locale: string, id: string, context: string) => string);
type MissingHandler = string | ((locale: string, id: string) => string);
type setupI18nProps = {

@@ -78,3 +75,3 @@ locale?: Locale;

activate(locale: Locale, locales?: Locales): void;
_(id: MessageDescriptor | string, values?: Values | undefined, { message, formats, context }?: MessageOptions | undefined): string;
_(id: MessageDescriptor | string, values?: Values | undefined, { message, formats }?: MessageOptions | undefined): string;
date(value: string | Date, format?: Intl.DateTimeFormatOptions): string;

@@ -81,0 +78,0 @@ number(value: number, format?: Intl.NumberFormatOptions): string;

{
"name": "@lingui/core",
"version": "3.17.2",
"version": "4.0.0-next.0",
"sideEffects": false,

@@ -30,3 +30,3 @@ "description": "I18n tools for javascript",

"engines": {
"node": ">=14.0.0"
"node": ">=16.0.0"
},

@@ -67,3 +67,6 @@ "exports": {

},
"gitHead": "31dcab5a9a8f88bfa8b3a2c7cd12aa2d908a1d80"
"devDependencies": {
"@lingui/jest-mocks": "^3.0.3"
},
"gitHead": "637f5cf6beda9d4ebce4e15cd9fdaa23e404b660"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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