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.
i18n-patch
Advanced tools
Replacing codes for i18n with patterns.
$ npm install -g i18n-replace
Usage
$ i18n-patch <locale>
Options
--config Base path for config files.
i18n.json and <locale>.json is required.
--src Base path for source files.
Current directory by default.
--out Base path for output files.
'out' by default.
Examples
$ i18n-patch --config config --src src --out dist ja
$ cd example
$ cat i18n.json
{
"translations": [
{
"src": "**/*.js",
"patterns": [
{
"pattern": "preview.text(\"Nothing to preview.\");",
"replace": "preview.text(\"${nothingToPreview}\");"
},
{
"pattern": "preview.text(\"Loading...\");",
"replace": "preview.text(\"${loading}\");"
}
]
}
]
}
$ cat ja.json
{
"nothingToPreview": "プレビューする内容がありません",
"loading": "読み込み中..."
}
$ cat src/js/sample.js
preview.text("Nothing to preview.");
preview.text("Loading...");
$ i18n-patch ja
$ cat out/js/sample.js
preview.text("プレビューする内容がありません");
preview.text("読み込み中...");
If you want to try, clone this repository and execute:
$ npm run build
$ node lib/cli.js --config example --src example/src --out example/out ja
Then you can confirm the result in example/out
directory.
The main purpose of this project is to provide an external i18n system for any existent source codes.
I'm maintaining gitlab-i18n-patch project to provide unofficial Japanese translation patch to GitLab.
In that project, when a new version of GitLab is released, I'm trying to merge big branch(tag) to translated branch.
This method has many problems:
patch
, so one patch cannot be applied to any other versions.Therefore, I thought it's better to create a new external translation system for providing i18n patch GitLab project without Git branch management.
MIT
FAQs
Replacing codes for i18n with patterns.
We found that i18n-patch 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.