
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@coscom/vite-plugin-lang
Advanced tools
Vite plugin to fetch and translate language files using external API
Automatically fetch and generate translation files for multiple languages during Vite build.
de.json
)npm install @coscom/vite-plugin-lang --save-dev
In your vite.config.js
or vite.config.ts
:
import { defineConfig } from 'vite'
import fetchLangPlugin from 'vite-plugin-lang'
export default defineConfig({
plugins: [
fetchLangPlugin({
inputLangPath: './public/translations/de.json', // Source language file (e.g., German)
outputLanguages: ['en', 'fr', 'it'], // Languages to generate
outputDir: './public/translations', // Output folder for translated files
apiUrl: 'http://localhost:5000/api/v1/strings', // Your translation API
indent: 2 // (Optional) JSON indentation
})
]
})
During the Vite build, this plugin:
de.json
)en
, fr
, it
, ...)en.json
, fr.json
, ...) to the output directoryYour API should accept a POST request like:
POST /api/v1/strings?targetLang=fr
Content-Type: application/json
{
"KEY1": "Wert 1",
"KEY2": "Wert 2"
}
And return:
{
"data": {
"KEY1": "Value 1",
"KEY2": "Value 2"
}
}
This plugin supports tests using Vitest.
npm test
public/
├── translations/
│ └── de.json
└── translations/
├── en.json
├── fr.json
└── it.json
Option | Type | Default | Description |
---|---|---|---|
inputLangPath | string | './translations/de.json' | Path to the source language file |
outputLanguages | string[] | ['en'] | List of target languages |
outputDir | string | './public/translations' | Folder where translated files are saved |
apiUrl | string | '' | Endpoint of your translation API |
indent | number | 2 | JSON indent spacing for output files |
MIT
Built with ❤️ to simplify multilingual Vite projects.
FAQs
Vite plugin to fetch and translate language files using external API
The npm package @coscom/vite-plugin-lang receives a total of 0 weekly downloads. As such, @coscom/vite-plugin-lang popularity was classified as not popular.
We found that @coscom/vite-plugin-lang demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.