New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

chrome-intl-code-gen

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chrome-intl-code-gen

Type safe i18n

latest
Source
npmnpm
Version
1.0.4
Version published
Weekly downloads
2
-60%
Maintainers
1
Weekly downloads
 
Created
Source

Chrome intl Code Gen

npm GitHub issues

It provide a webpack plugin for watching chrome extesion's _locales directory, if locale file changed, A typescript file which contains a type-safe version of chrome.i18n.getMessage will be generated at the output path. the file contents includes a default export and multiple exports like this. Also you can customize your own generated content with the template option.

/* eslint-disable */
// This file is generated by chrome-i18n-code-gen, do not edit it

export type ChromeI18nKeys = "extName" | "extDescription"

export default function i18n(key: ChromeI18nKeys): string {
    return chrome.i18n.getMessage(key)
}
        
/**
* extension name
*/
export function extName(): string {
    return chrome.i18n.getMessage('extName')
}
            
/**
* extension description
*/
export function extDescription(): string {
    return chrome.i18n.getMessage('extDescription')
}

Usage

const ChromeIntlCodeGenPlguin = require('chrome-intl-code-gen').default;

[
    new ChromeIntlCodeGenPlguin({
      input: "public/_locales",
      output: "src/shared/locale.ts"
    })
]

Options

interface Options {
    /**
     * path of `_locales` directory 
     */
    input: string;
    /**
     * output typescript file path
     */
    output: string;
    /**
     * base language, defaults to en
     */
    base?: string;
    /**
     * optional custom template function to generate your own output file
     * interface Message { [keyName: string]: { "message": string;  "description": string; } }
     */
    template?: ((data: Message) => string);
}

Keywords

chrome

FAQs

Package last updated on 02 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts