
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
@bytesoftio/translator
Advanced tools
yarn add @bytesoftio/translator or npm install @bytesoftio/translator
A very simple library to handle translations.
Creates a new instance of ObservableTranslator.
import { createTranslator } from "@bytesoftio/translator"
const translations = {
en: { title: "Foo", about: { company: "Acme" } },
de: { title: "Bar" }
}
const language = "de"
const fallbackLanguage = "en"
const translator = createTranslator(translations, language, fallbackLanguage)
A quick tour of the available methods:
import { createTranslator } from "@bytesoftio/translator"
const translator = createTranslator({ en: { title: "Foo", about: "https://$1", nested: { text: "Bar" } }}, "en")
// get current language
translator.getLanguage()
// change current language
translator.setLanguage("de")
// get available languages
translator.getLanguages()
// get all translations
translator.getTranslations()
// get translations for a specific language
translator.getTranslationsForLanguage("en")
// replace all translations
translator.setTranslations({ en: { /* ... */ }})
// replace translations for a specific language
translator.setTranslationsForLanguage("en", { /* ... */ })
// add translations for multiple languages at once
translator.addTranslations({ en: { title: "Bar" } })
// add translations for a specific language
translator.addTranslationsForLanguage("en", { subtitle: "Yolo" })
// get fallback language ...
translator.getFallbackLanguage()
// update fallback language
translator.setFallbackLanguage("en")
// get a translated string, returns "Foo"
translator.get("title")
// get an interpolated translated string, returns "https://github.com"
translator.get("about", ["github.com"])
// get translation for a specific language, returns "{ title }"
translator.get("title", undefined, "de")
// get translation with a nestted key, returns "Bar"
translator.get("nested.text")
// check if a translation exists
translator.has("foo")
// check if a translation exists for a specific language
translator.has("foo", "de")
// listen to language, translations or fallbackLanguage changes
translator.listen(translator => console.log(translator.getLanguage()))
// create a nested translate function, all translation keys be prefixed with the given scope "nested"
const scopedTranslate = translator.scope("nested")
// same as translator.get("nested.text")
scopedTranslate("text")
This package provides a seemles integration with React hooks: @bytesoftio/use-translator
FAQs
## Installation
We found that @bytesoftio/translator 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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.