
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
A lightweight internationalization tool for managing translations, with JSON file output.
A lightweight internationalization management tool that uses SQLite for managing
translations, with JSON file output. The i18n
CLI provides quick and easy interaction with the database for
adding and editing locales, resources, and translations; Or you can access the SQLite database directly for complex
queries using something like SQLite Browser.
Advantages over manually maintaining JSON files:
xliff
, csv
, and json
files.npm install -g i18n-db
i18n --help
init
Setup configuration and initialize database.
i18n init
Options:
Option | Alias | Type | Description | Default |
---|---|---|---|---|
--defaultLocale | -l | string | Default locale to set. | en-US |
--directory | -d | string | Directory to store database file, relative to root. | ./i18n |
--output | -o | string | Directory to store generated files, relative to root. | ./i18n |
import [file]
Import translation records.
Options:
Option | Alias | Type | Description | Default |
---|---|---|---|---|
--format | -f | string | File format. Available: xliff , csv , json | xliff |
--locale | -l | string | Locale code to import translations for. | defaultLocale |
--bump | -b | boolean | Save translations (bumping version number) even if the value has not changed. | false |
export
Alias: x
Export translations for translation. Files are created at ./i18n-export
; This directory can be added to gitignore.
Options:
Option | Alias | Type | Description | Default |
---|---|---|---|---|
--format | -f | string | Output file format. Available: xliff , csv , json | xliff |
--locale | -l | string | Locale code to export translations for. | all |
generate
Alias: g
Generate locale JSON files. A file for each locale will be generated that contains translated resources. Any resources that are missing a translation for a locale will not be included in the generated file.
Example output file structure:
./i18n
en-US.json
es-MX.json
fr-CA.json
Example output file content:
// en-US.json
{
"key": "translation value",
"Greeting": "Hello World!",
"Common": {
"Yes": "Yes"
},
...
}
locale list
Aliases:
locale ls
l ls
List all locales.
locale set [code]
Alias: l set [code]
Add/update a locale record.
Options:
Option | Alias | Type | Description | Default |
---|---|---|---|---|
--fullName | -n | string | Locale full name. | n/a |
locale remove [code]
Aliases:
l remove [code]
l rm [code]
Remove a locale record and all associated translations.
resource list
Aliases:
r list
r ls
List all resources.
resource rename [oldKey] [newKey]
Aliases:
r rename [oldKey] [newKey]
r ren [oldKey] [newKey]
Rename a resource key.
resource remove [key]
Aliases:
r remove [key]
r rm [key]
Remove a resource record and all associated translations.
translate list
Aliases:
t list [key]
t ls [key]
List translations.
Option | Alias | Type | Description | Default |
---|---|---|---|---|
--term | -t | string | Optional search term to filter by. Wildcard character: % | n/a |
--key | -k | string | Optional resource key filter by. Wildcard character: % | n/a |
--locale | -l | string | Optional locale code to filter by. | n/a |
translate duplicates
Aliases:
t duplicates
t d
Find duplicate translations.
translate set [key] [value]
Alias: t set [key] [value]
Add/update a translation record.
Options:
Option | Alias | Type | Description | Default |
---|---|---|---|---|
--desc | -d | string | Resource description. | n/a |
--locale | -l | string | Translation locale code. | defaultLocale |
Configuration options are stored in a i18n.json
file. The following properties are supported:
Name | Type | Description |
---|---|---|
defaultLocale | string | Default locale. |
directory | string | Directory to store database file, relative to root. |
output | string or object[] | Directory to store generated files, relative to root. |
nested | boolean | Determines if nested JSON should be generated. |
The output
property can be an array of objects to define multiple output destinations.
{
"output": [
{
"match": null,
"directory": "./i18n/everything"
},
{
"match": "Common.*",
"directory": "./i18n/common-only"
},
{
"match": "MyApp.*",
"directory": "./projects/MyApp/i18n"
}
]
}
Option | Type | Description |
---|---|---|
match | string or null | Optional pattern to filter resource by key. (1) |
directory | string | Directory to store generated files, relative to root. |
(1) See the micromatch package for details of the patterns you can specify.
Adding translations from scratch.
i18n init
# add translation to default locale
i18n translation set "Greeting" "Hello"
# add more locales
i18n locale set "es-MX"
i18n locale set "zh"
# add a translations of "Greeting" for new locales
i18n translation set "Greeting" "Hola" --locale "es-MX"
i18n translation set "Greeting" "你好" --locale "zh"
# generate locale files
i18n generate
Add translations from a translator.
i18n init
# add translation to default locale
i18n translation set "Greeting" "Hello"
# add another locale
i18n locale set "es-MX"
# export translation file(s) for translator
i18n export
# send "es-MX.xliff" file to translator ...
# import translations
i18n import ./es-MX_done.xliff
# generate locale files
i18n generate
Clone the repo and run the following commands in the i18n-db
directory:
npm ci
npm link
npm run build
FAQs
A lightweight internationalization tool for managing translations, with JSON file output.
The npm package i18n-db receives a total of 2 weekly downloads. As such, i18n-db popularity was classified as not popular.
We found that i18n-db 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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.