Skip to main content
Sonamu has a built-in type-safe internationalization (i18n) system. Through the SD (Sonamu Dictionary) function, it detects key typos at compile time and automatically extracts Entity labels to simplify translation work.

Key Features

  • Type Safety: Compile-time errors when using non-existent keys
  • Automatic Entity Label Extraction: title, prop.desc, and enum labels are automatically included in the dictionary
  • Function Value Support: Dynamic message generation ((count) => \$ itemsโ€œ)
  • Korean Helpers: Particle handling (์€/๋Š”, ์ด/๊ฐ€), pluralization, etc.
  • Excel import/export: Manage translation files through Sonamu UI
  • Locale-specific Column Support: Multilingual DB columns like name_ko, name_en

Architecture

Auto-generated Files

sd.generated.ts includes the following:
ItemDescriptionExample Key
Entity TitleEntityโ€™s title propertyentity.User
Prop Labelpropโ€™s desc propertyentity.User.email
Enum LabelenumLabels definitionenum.UserRole.admin
SD FunctionType-safe translation function-
localizedColumnMultilingual DB column support-

Workflow

  1. Define title, prop.desc, and enumLabels in Entity
  2. Run pnpm sync to auto-generate sd.generated.ts
  3. Write project dictionaries in ko.ts, en.ts
  4. Use SD("key") function to get text matching the current locale

Setup

Initial i18n configuration

Using the SD Function

Writing and using dictionaries