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.
@deckweiss/internationalization
Advanced tools
This repository contains internationalization for SvelteKit.
This repository contains internationalization for SvelteKit.
pnpm i @deckweiss/internationalization
// src/i18n.ts
import { initialize as initializeI18n } from '@deckweiss/internationalization';
import de from '$lib/translations/de.json';
import en from '$lib/translations/en.json';
initializeI18n({
defaultLocale: 'en',
locales: {
de,
en
}
});
// src/hooks.server.ts
import { handle } from '@deckweiss/internationalization';
import './i18n.js';
export { handle };
// hooks.client.ts
import './i18n.js';
// +page.svelte
<script>
import { t } from '@deckweiss/internationalization';
</script>
<p>{$t('app.day', { date: Date.now() })}</p>
// src/lib/components/language-picker.svelte
<script>
import { locale, locales, setLocale } from '@deckweiss/internationalization';
</script>
<select value={$locale} on:change={(event) => setLocale(event.target.value)}>
<option disabled>Choose language</option>
{#each locales as l}
<option value={l} selected={l === $locale}>{l}</option>
{/each}
</select>
This package is compatible with i18next JSON v4. Although, it currently does only support nested keys and interpolation with formatting.
// src/lib/translations/en.json
{
"app": {
"name": "Example app",
"day": "Today is {{date, date(format: dddd)}}"
}
}
Usage | Output |
---|---|
$t('app.name') | "Example app" |
$t('app.day', { date: new Date(1997, 4, 22) })} | "Today is Thursday" |
Date format symbols can be found here. Bundled date languages
pnpm version
.chore: release
FAQs
This repository contains internationalization for SvelteKit.
The npm package @deckweiss/internationalization receives a total of 183 weekly downloads. As such, @deckweiss/internationalization popularity was classified as not popular.
We found that @deckweiss/internationalization 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.
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.