New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

i18n-dialect

Package Overview
Dependencies
Maintainers
10
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

i18n-dialect - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

4

dist/src/controller.d.ts

@@ -18,4 +18,4 @@ import { Descriptor, Scalar } from './types';

protected getUntranslatedFallback(descriptor: Descriptor): string[];
protected selectPluralForm(forms: string[], descriptor: Descriptor, forceUntranslated: boolean): string;
protected substituteStrings(str: string, descriptor: Descriptor): string;
protected selectPluralForm(forms: string[], descriptor: Descriptor, forceUntranslated: boolean): string | undefined;
protected substituteStrings(str: string | undefined, descriptor: Descriptor): string;
protected makeNewDict(items: I18NEntry[]): {

@@ -22,0 +22,0 @@ [key: string]: string[];

@@ -101,3 +101,10 @@ "use strict";

TranslationController.prototype.substituteStrings = function (str, descriptor) {
var tmpStr = str;
var tmpStr = str || '';
// Fallback, than everything went wrong
if (!tmpStr.length) {
if (this.onFailedSubstitution) {
this.onFailedSubstitution('', descriptor.substitutions);
}
return descriptor.msgid;
}
// substitute optional parameters

@@ -113,3 +120,3 @@ descriptor.substitutions.forEach(function (value, index) {

if (this.onFailedSubstitution && tmpStr.match(/%\d+/)) {
this.onFailedSubstitution(str, descriptor.substitutions);
this.onFailedSubstitution(str || '', descriptor.substitutions);
}

@@ -116,0 +123,0 @@ return tmpStr;

{
"name": "i18n-dialect",
"version": "1.1.0",
"version": "1.1.1",
"description": "Internationalization support library",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -97,3 +97,3 @@ import { Descriptor, Scalar } from './types';

// Select proper plural form based on descriptor
protected selectPluralForm(forms: string[], descriptor: Descriptor, forceUntranslated: boolean): string {
protected selectPluralForm(forms: string[], descriptor: Descriptor, forceUntranslated: boolean): string | undefined {
switch (descriptor.type) {

@@ -116,5 +116,13 @@ case '_t':

// Substitute parameters to %1, %2, etc and %% placeholders
protected substituteStrings(str: string, descriptor: Descriptor): string {
let tmpStr = str;
protected substituteStrings(str: string | undefined, descriptor: Descriptor): string {
let tmpStr = str || '';
// Fallback, than everything went wrong
if (!tmpStr.length) {
if (this.onFailedSubstitution) {
this.onFailedSubstitution('', descriptor.substitutions);
}
return descriptor.msgid;
}
// substitute optional parameters

@@ -132,3 +140,3 @@ descriptor.substitutions.forEach((value, index) => {

if (this.onFailedSubstitution && tmpStr.match(/%\d+/)) {
this.onFailedSubstitution(str, descriptor.substitutions);
this.onFailedSubstitution(str || '', descriptor.substitutions);
}

@@ -135,0 +143,0 @@

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