Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
translation-adapter-ts
Advanced tools
The translation adapter for i18n_mrg tool support in TypeScript projects.
npm i translation-adapter-ts
import {PofileTransformer} from "translation-adapter-ts/src/PofileTransformer";
let transformer = new PofileTransformer();
transformer.transformDirectory('i18n/ru_RU/LC_MESSAGES');
transformer.transformDirectory('i18n/zh_CN/LC_MESSAGES');
import {Localizator} from "translation-adapter-ts/src/Localizator";
import {LanguageEnum} from "translation-adapter-ts/src/Enums/LanguageEnum";
import * as data from "translation-adapter-ts/test/translationFiles/test.json";
import {readFileSync} from "fs";
Localizator.addTranslation(LanguageEnum.RU, data);
Localizator.addTranslation(LanguageEnum.CN, readFileSync('/test/translationFiles/cn.json'));
Localizator.setDefaultLanguge(LanguageEnum.EN);
Localizator.setLanguage(LanguageEnum.RU);
If you use babel, with TS resolveJsonModule compiler directive, you may encounter an issue with data structure being exported as module with no default export. There's a workaround to fix that:
import * as data from "translation-adapter-ts/test/translationFiles/test.json";
//@ts-ignore
Localizator.addTranslation(LanguageEnum.RU, data.default);
import {__} from 'translation-adapter-ts/src/Main.ts';
console.log(__("Test string"));
console.log(__("Hello, %s", __("world")));
console.log(__("Hey %hello% %world%!"), {"%world%": __('world'), "hello": __("Hello")}); // In case if placeholder order may be different in different languages
FAQs
The translation adapter for i18n_mrg tool support in TypeScript projects.
The npm package translation-adapter-ts receives a total of 64 weekly downloads. As such, translation-adapter-ts popularity was classified as not popular.
We found that translation-adapter-ts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.