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.3 to 0.0.5

dist/tsdoc-metadata.json

104

dist/main.d.ts

@@ -1,26 +0,82 @@

declare module '@vscode/l10n/main' {
export interface l10nJsonMessageFormat {
message: string;
comment: string[];
}
export type MessageInfo = string | l10nJsonMessageFormat;
export interface l10nJsonFormat {
[key: string]: MessageInfo;
}
export function config(config: {
uri: string | URL;
} | {
contents: string | l10nJsonFormat;
}): void;
export function t(str: string, ...args: any[]): string;
export function t(options: {
message: string;
args?: any[];
comment?: string[];
}): string;
/**
* @public
* Must be run as soon as possible. Loads the bundle from the given URI or contents.
* @param config - The uri or contents of the bundle.
*/
export declare function config(config: {
uri: string | URL;
} | {
contents: string | l10nJsonFormat;
}): void;
/**
* @public
* The format of package.nls.json and l10n bundle files.
*/
export declare interface l10nJsonFormat {
[key: string]: l10nJsonMessageFormat;
}
declare module '@vscode/l10n' {
import main = require('@vscode/l10n/main');
export = main;
}
/**
* @public
* The format of a message in a bundle.
*/
export declare type l10nJsonMessageFormat = string | {
message: string;
comment: string[];
};
/**
* @public
* Marks a string for localization. If the bundle has a localized value for this message, then that localized
* value will be returned (with injected `args` values for any templated values).
* @param message - The message to localize. Supports index templating where strings like `{0}` and `{1}` are
* replaced by the item at that index in the `args` array.
* @param args - The arguments to be used in the localized string. The index of the argument is used to
* match the template placeholder in the localized string.
* @returns localized string with injected arguments.
* @example `l10n.localize('hello', 'Hello {0}!', 'World');`
*/
export declare function t(message: string, ...args: Array<string | number | boolean>): string;
/**
* @public
* Marks a string for localization. If the bundle has a localized value for this message, then that localized
* value will be returned (with injected `args` values for any templated values).
* @param message - The message to localize. Supports named templating where strings like `{foo}` and `{bar}` are
* replaced by the value in the Record for that key (foo, bar, etc).
* @param args - The arguments to be used in the localized string. The name of the key in the record is used to
* match the template placeholder in the localized string.
* @returns localized string with injected arguments.
* @example `l10n.t('Hello {name}', { name: 'Erich' });`
*/
export declare function t(message: string, args: Record<string, any>): string;
/**
* @public
* Marks a string for localization. If the bundle has a localized value for this message, then that localized
* value will be returned (with injected args values for any templated values).
* @param options - The options to use when localizing the message.
* @returns localized string with injected arguments.
*/
export declare function t(options: {
/**
* The message to localize. If `args` is an array, this message supports index templating where strings like
* `{0}` and `{1}` are replaced by the item at that index in the `args` array. If `args` is a `Record<string, any>`,
* this supports named templating where strings like `{foo}` and `{bar}` are replaced by the value in
* the Record for that key (foo, bar, etc).
*/
message: string;
/**
* The arguments to be used in the localized string. As an array, the index of the argument is used to
* match the template placeholder in the localized string. As a Record, the key is used to match the template
* placeholder in the localized string.
*/
args?: Array<string | number | boolean> | Record<string, any>;
/**
* A comment to help translators understand the context of the message.
*/
comment: string | string[];
}): string;
export { }

@@ -1,1 +0,1 @@

"use strict";var a=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var c=(n,t)=>{for(var r in t)a(n,r,{get:t[r],enumerable:!0})},l=(n,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of u(t))!p.call(n,e)&&e!==r&&a(n,e,{get:()=>t[e],enumerable:!(s=f(t,e))||s.enumerable});return n};var y=n=>l(a({},"__esModule",{value:!0}),n);var J={};c(J,{config:()=>d,t:()=>F});module.exports=y(J);var m=require("fs"),g;function d(n){if("contents"in n){typeof n.contents=="string"?g=JSON.parse(n.contents):g=n.contents;return}if(n.uri){let t=n.uri;typeof n.uri=="string"&&n.uri.startsWith("file://")&&(t=new URL(n.uri)),g=JSON.parse((0,m.readFileSync)(t,"utf8"))}}var x=/{(\d+)}/g;function o(n,...t){return t.length===0?n:n.replace(x,function(r,s){let e=parseInt(s,10);return isNaN(e)||e<0||e>=t.length?r:t[e]})}function F(...n){let t=n[0],r,s,e;if(typeof t=="string"?(r=t,s=t,n.splice(0,1),e=n):(s=t.message,r=s,t.comment&&t.comment.length>0&&(r+=`/${t.comment.join()}`),e=t.args??[]),!g)return o(s,...e);let i=g[r];return i?typeof i=="string"?o(i,...e):i.comment?o(i.message,...e):o(s,...e):o(s,...e)}0&&(module.exports={config,t});
"use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var l=(n,r)=>{for(var e in r)a(n,e,{get:r[e],enumerable:!0})},y=(n,r,e,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let t of c(r))!f.call(n,t)&&t!==e&&a(n,t,{get:()=>r[t],enumerable:!(s=u(r,t))||s.enumerable});return n};var p=n=>y(a({},"__esModule",{value:!0}),n);var A={};l(A,{config:()=>d,t:()=>R});module.exports=p(A);var m=require("fs"),g;function d(n){if("contents"in n){typeof n.contents=="string"?g=JSON.parse(n.contents):g=n.contents;return}if(n.uri){let r=n.uri;typeof n.uri=="string"&&n.uri.startsWith("file://")&&(r=new URL(n.uri)),g=JSON.parse((0,m.readFileSync)(r,"utf8"))}}function R(...n){let r=n[0],e,s,t;if(typeof r=="string"?(e=r,s=r,n.splice(0,1),t=!n||typeof n[0]!="object"?n:n[0]):(s=r.message,e=s,r.comment&&r.comment.length>0&&(e+=`/${Array.isArray(r.comment)?r.comment.join():r.comment}`),t=r.args??{}),!g)return o(s,t);let i=g[e];return i?typeof i=="string"?o(i,t):i.comment?o(i.message,t):o(s,t):o(s,t)}var b=/{([^}]+)}/g;function o(n,r){return n.replace(b,(e,s)=>r[s]??e)}0&&(module.exports={config,t});
{
"name": "@vscode/l10n",
"version": "0.0.3",
"version": "0.0.5",
"description": "A helper library to assist in localizing subprocesses spun up by VS Code extensions",

@@ -20,2 +20,3 @@ "author": "Microsoft Corporation",

"devDependencies": {
"@microsoft/api-extractor": "^7.32.1",
"@types/mocha": "^9.1.1",

@@ -31,8 +32,9 @@ "@types/mock-fs": "^4.13.1",

"mock-fs": "^5.1.4",
"npm-dts": "^1.3.12",
"rimraf": "^3.0.2",
"ts-node": "^10.9.1"
"ts-node": "^10.9.1",
"typescript": "^4.7.4"
},
"scripts": {
"compile": "rimraf dist && tsc -noEmit && node .esbuild.config.js",
"clean": "rimraf dist && rimraf lib",
"compile": "npm run clean && tsc --emitDeclarationOnly --outDir lib && node .esbuild.config.js",
"lint": "eslint src --ext ts",

@@ -39,0 +41,0 @@ "watch": "node .esbuild.config.js --watch",

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