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

@vscode/l10n

Package Overview
Dependencies
Maintainers
7
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vscode/l10n - npm Package Compare versions

Comparing version 0.0.13 to 0.0.14

15

dist/browser.js

@@ -60,2 +60,12 @@ // src/browser/reader.ts

formatArgs = !args || typeof args[0] !== "object" ? args : args[0];
} else if (firstArg instanceof Array) {
const replacements = args.slice(1);
if (firstArg.length !== replacements.length + 1) {
throw new Error("expected a string as the first argument to l10n.t");
}
let str = firstArg[0];
for (let i = 1; i < firstArg.length; i++) {
str += `{${i - 1}}` + firstArg[i];
}
return t(str, ...replacements);
} else {

@@ -69,6 +79,3 @@ message = firstArg.message;

}
if (!bundle) {
return format(message, formatArgs);
}
const messageFromBundle = bundle[key];
const messageFromBundle = bundle?.[key];
if (!messageFromBundle) {

@@ -75,0 +82,0 @@ return format(message, formatArgs);

@@ -56,2 +56,8 @@ /**

* @public
* Type that can be used as replacements in `l10n.t()` calls.
*/
export declare type L10nReplacement = string | number | boolean;
/**
* @public
* Marks a string for localization. If the bundle has a localized value for this message, then that localized

@@ -66,3 +72,3 @@ * value will be returned (with injected `args` values for any templated values).

*/
export declare function t(message: string, ...args: Array<string | number | boolean>): string;
export declare function t(message: string, ...args: Array<L10nReplacement>): string;

@@ -80,6 +86,22 @@ /**

*/
export declare function t(message: string, args: Record<string, any>): string;
export declare function t(message: string, args: Record<string, L10nReplacement>): string;
/**
* @public
* Marks a string for localization. This function signature is made for usage
* with tagged template literals.
*
* The more verbose overload should still be used if comments are required.
* @example
* ```
* l10n.t`Hello ${name}!`
* ```
* @param message - String message components
* @param args - Replacement components in the string
* @returns localized string with injected arguments.
*/
export declare function t(strs: TemplateStringsArray, ...replacements: L10nReplacement[]): string;
/**
* @public
* Marks a string for localization. If the bundle has a localized value for this message, then that localized

@@ -86,0 +108,0 @@ * value will be returned (with injected args values for any templated values).

@@ -902,2 +902,12 @@ "use strict";

formatArgs = !args || typeof args[0] !== "object" ? args : args[0];
} else if (firstArg instanceof Array) {
const replacements = args.slice(1);
if (firstArg.length !== replacements.length + 1) {
throw new Error("expected a string as the first argument to l10n.t");
}
let str = firstArg[0];
for (let i = 1; i < firstArg.length; i++) {
str += `{${i - 1}}` + firstArg[i];
}
return t(str, ...replacements);
} else {

@@ -911,6 +921,3 @@ message = firstArg.message;

}
if (!bundle) {
return format(message, formatArgs);
}
const messageFromBundle = bundle[key];
const messageFromBundle = bundle?.[key];
if (!messageFromBundle) {

@@ -917,0 +924,0 @@ return format(message, formatArgs);

{
"name": "@vscode/l10n",
"version": "0.0.13",
"version": "0.0.14",
"description": "A helper library to assist in localizing subprocesses spun up by VS Code extensions",

@@ -5,0 +5,0 @@ "author": "Microsoft Corporation",

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