
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
A fast command-line tool for translating JSON files using Google Translate API. Perfect for i18n workflows with batch translation, recursive search, and incremental updates.
A command-line tool for translating JSON files using Google Translate API. Perfect for i18n (internationalization) workflows.
npm install -g tr-file
tr_file <source-file> <target-languages> [options]
# Translate en.json to Spanish, Japanese, and Portuguese (uses built-in API key)
tr_file en.json es,ja,pt
# With custom API key
tr_file en.json es,ja,pt -k YOUR_API_KEY
# With custom delay between requests
tr_file en.json es,ja,pt -d 200
# Recursive translation - find all 'en.json' files in subdirectories
tr_file en.json es,fr,de --recursive
Search for and translate all files with a specific name in all subdirectories:
# Find all 'en.json' files recursively and translate them
tr_file en.json es,fr,de --recursive
# Short form with -r flag
tr_file en.json es,fr,de -r
Recursive Example:
project/
├── frontend/
│ └── locales/
│ ├── en.json ← Found and translated
│ ├── es.json ← Generated
│ └── fr.json ← Generated
├── backend/
│ └── i18n/
│ ├── en.json ← Found and translated
│ ├── es.json ← Generated
│ └── fr.json ← Generated
└── mobile/
└── lang/
├── en.json ← Found and translated
├── es.json ← Generated
└── fr.json ← Generated
-k, --key <key>
: Google Translate API key (optional - uses built-in key if not provided)-d, --delay <ms>
: Delay between requests in milliseconds (default: 50ms)-r, --recursive
: Search for source file in all subdirectoriesQuick Start: The tool works immediately with a built-in API key - no setup required!
# Install and use right away
npm install -g tr-file
tr_file en.json es,ja,pt
Optional - Use your own API key:
Get a Google Translate API key:
Set your API key (choose one method):
# Option 1: Environment variable
export GOOGLE_TRANSLATE_API_KEY="your-api-key-here"
# Option 2: Use the -k flag
tr_file en.json es,ja,pt -k "your-api-key-here"
Input (en.json):
{
"greeting": "Hello",
"navigation": {
"home": "Home",
"about": "About Us"
},
"messages": {
"welcome": "Welcome to our app",
"goodbye": "Thank you for visiting"
}
}
Output (es.json):
{
"greeting": "Hola",
"navigation": {
"home": "Inicio",
"about": "Acerca de nosotros"
},
"messages": {
"welcome": "Bienvenido a nuestra aplicación",
"goodbye": "Gracias por visitarnos"
}
}
The tool supports all languages supported by Google Translate API. Common language codes include:
es
- Spanishfr
- Frenchde
- Germanit
- Italianpt
- Portugueseja
- Japaneseko
- Koreanzh
- Chineseru
- Russianar
- ArabicThe tool intelligently handles existing translation files:
Example:
# First run - translates all keys
tr_file en.json es # Creates es.json with all translations
# Add new keys to en.json
echo '{"new.key": "New text"}' >> en.json
# Second run - only translates new keys
tr_file en.json es # Only translates "new.key", preserves existing translations
The tool uses batch translation for maximum efficiency:
Example Performance:
The tool includes built-in rate limiting to avoid hitting Google Translate API limits. You can adjust the delay between requests using the -d
option.
MIT
[1.0.0] - 2025-07-11
tr_file en.json es,fr,de
- Basic translationtr_file en.json es,fr,de --recursive
- Recursive translationtr_file en.json es,fr,de -k YOUR_KEY
- Custom API keytr_file en.json es,fr,de -d 100
- Custom delayFAQs
A fast command-line tool and TypeScript/JavaScript library for translating JSON files using Google Translate API. Features structure preservation, placeholder protection, batch translation, recursive search, incremental updates, array support, and program
The npm package tr-file receives a total of 7 weekly downloads. As such, tr-file popularity was classified as not popular.
We found that tr-file demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.