Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityUse PowerShell OSLicense Module to manage Windows Activation(19.09.2026 um 13:13 Uhr)
Sichere ProgrammierungHalb so teuer wie Claude: Google veröffentlicht Gemini 3.8 Flash(19.09.2026 um 16:00 Uhr)
Sichere ProgrammierungThe New CSS Property I Wish Existed Years Ago(19.09.2026 um 16:02 Uhr)
Sichere ProgrammierungLearning AWS as a Java developer: where I'm starting and why(19.09.2026 um 16:03 Uhr)
Sichere ProgrammierungHooks in Claude Code: A Beginner's Guide(19.09.2026 um 16:14 Uhr)
Sichere ProgrammierungI Built EchoCadence: A Vocabulary App Built to Make Words Stick 🔁(19.09.2026 um 16:18 Uhr)
Sichere Programmierung#javascript #webdev #html #showdev(19.09.2026 um 16:21 Uhr)
Windows Tipps & SecurityUse PowerShell OSLicense Module to manage Windows Activation(19.09.2026 um 13:13 Uhr)
Sichere ProgrammierungHalb so teuer wie Claude: Google veröffentlicht Gemini 3.8 Flash(19.09.2026 um 16:00 Uhr)
Sichere ProgrammierungThe New CSS Property I Wish Existed Years Ago(19.09.2026 um 16:02 Uhr)
Sichere ProgrammierungLearning AWS as a Java developer: where I'm starting and why(19.09.2026 um 16:03 Uhr)
Sichere ProgrammierungHooks in Claude Code: A Beginner's Guide(19.09.2026 um 16:14 Uhr)
Sichere ProgrammierungI Built EchoCadence: A Vocabulary App Built to Make Words Stick 🔁(19.09.2026 um 16:18 Uhr)
Sichere Programmierung#javascript #webdev #html #showdev(19.09.2026 um 16:21 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

Kotori, strongly typed and modular i18n library for React

Kotori is a strongly-typed, modular i18n library for React. It’s designed for developers who care about type safety and developer experience without the overhead.

  • Size: 0.39kb gzipped.
  • Dependencies: Zero.
  • Setup: No JSON, no codegen, no schema files.

The "Magic": Type-Inferred Variables

The standout feature of Kotori is how it leverages TypeScript’s template literal types to parse your strings. Instead of maintaining a separate schema or running a codegen step, your primary language string becomes the type contract.

If your English string contains {{name}}, Kotori ensures that every other language also includes {{name}}, and that you provide a name value when calling the translation function.

const { dict } = kotori({
    primaryLanguageTag: 'en',
    secondaryLanguageTags: ['zh', 'ja', 'ms'],
})

// ❌ TypeScript error: missing japanese translation
const intro = dict({ 
    // The "Source of Truth"
    en: 'Hello {{name}}, is it {{time}} now?', 

    // ❌ TypeScript error: missing key 'name' 
    zh: '你好,现在是 {{time}} 吗?', 

    // ❌ TypeScript error: unknown key 'nam'      
    ms: 'Hai {{nam}}, adakah pukul {{time}} sekarang?'  
})<{ name: string; time: `${number}:${number}` }> 
// ^ Optional: Narrow your types further

By turning your strings into a strict contract, Kotori catches the most common i18n bugs during development rather than in production:

// ✅ Works perfectly
t('intro', { name: 'John', time: '12:25' }) 

// ❌ TypeScript error: missing { name }
t('intro', { time: '12:25' })

// ❌ TypeScript error: unknown key 'nama'                   
t('intro', { nama: 'John', time: '12:25' }) 

// ❌ TypeScript error: invalid format for 'time' (expects HH:MM)
t('intro', { name: 'John', time: '12-00' })

This approach eliminates the "string typo" category of bugs entirely. If the code compiles, you can be confident that your variables are correctly mapped across all supported languages.

Truly Modular (Tree-shakeable)

Most standard i18n libraries load one giant, centralized dictionary. Kotori flips this model. It encourages you to colocate your translations directly inside the component or feature files that use them.

kotori modularity

By separating definitions this way, you are leveraging the native power of modern bundlers (like Vite or Webpack) to code-split your translations automatically. A user visiting /page1 never downloads the translations for /page2.

You define the translation where you need it:

// page1.tsx
import { createTranslations, dict } from './utils'

const intro = dict({
    en: 'my name is {{name}}, I am {{age}} years old.',
    zh: '我叫{{name}},我今年{{age}}岁了。',
})

const { useTranslations } = createTranslations({ intro })

Because of this modular design, your bundler can naturally code-split your translations. You only load the strings for the page the user is actually visiting.

Global State, Local Definition

It’s important to note that while your definitions are localized to the component, the underlying language state is global. Your kotori instance (usually defined in a utility file) manages the current locale.

When you call setLanguage('jp') in a settings component on Page 1, every useTranslations hook across Page 2, Page 3, and any child component re-renders with the new Japanese strings instantly.

Give it a try
I built Kotori because I was tired of the friction in existing i18n workflows. I wanted a solution that is:

  • Fully Type-Safe: Catch missing variables and translation keys at compile time, not in production.

  • Truly Modular: Enable automatic code-splitting by colocating translations with their components.

  • Zero-Config: No JSON files, no external CLI tools, and no codegen. Just pure TypeScript.

If you’re looking for a lightweight, "invisible" way to handle internationalization in React, I’d love for you to check it out and let me know what you think.

GitHub: https://github.com/tylim88/Kotori

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Kotori, strongly typed and modular i18n library for React

Thematisch verwandte Begriffe: Kotori, strongly, typed, modular · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-61591 | djust provides Phoenix LiveView-style reactive server-side rendering for…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick