Settings

Sidebar
Display
Profile Panel
👤

John Doe

Administrator
  • 📊 Dashboard
  • 📝 Forms
  • 📋 Tables
Commands
🚀
Go to Page
Navigate to a page
/go
🌓
Toggle Theme
Switch between light and dark mode
/theme
📐
Toggle Sidebar
Show or hide the sidebar
/sidebar
⚙️
Open Settings
Open the settings panel
/settings
Search In
📄
Pages
Search pages
:p
🧩
Components
Search component pages
:c
The i18n (Internationalization) module provides translation support for the library's built-in components using svelte-i18n. It includes a reactive i18n service for managing languages and locales.

Interactive Demo

Try the i18n service in action. Switch languages, add new ones, and see the reactive state update.

Language Switcher
Current State:
  • currentLocale: en
  • isLoading: false
  • languages.length: 2
Manage Languages
Current Languages:
English (en) Czech (cs)
Add Language:
Live Translation Preview
Dialog Keys:
  • dialog.confirm: dialog.confirm
  • dialog.cancel: dialog.cancel
  • dialog.ok: dialog.ok
  • dialog.areYouSure: dialog.areYouSure
Other Keys:
  • popconfirm.confirm: popconfirm.confirm
  • popconfirm.cancel: popconfirm.cancel
  • loadMore.loadMore: loadMore.loadMore
  • loadMore.loading: loadMore.loading

Overview

Pure Admin uses svelte-i18n for internationalization with an enhanced i18n service that provides reactive language management using Svelte 5 runes.

  • Built-in translations - English and Czech for all library components
  • Reactive i18n service - Manage languages and locales with Svelte 5 runes
  • Flexible loading - Bundled, injected, or async/API loading strategies
  • Easy setup - Works out of the box, or customize with i18n.init()
  • svelte-i18n compatible - Full access to all svelte-i18n features

Reserved Namespaces

The library uses these translation key namespaces for its components:

dialog.*

Dialog service (confirm, alert, prompt)

popconfirm.*

Popconfirm component

shortcuts.*

Shortcut help dialog

commandPalette.*

Command palette component

Loading Scenarios

The i18n system supports three loading strategies to fit different application needs.

1 Bundled (Default)

Works out of the box with built-in English and Czech translations. No initialization required.

2 Injected at Init

App provides translations at initialization (e.g., embedded in HTML by backend).

3 Async/API Loading

Load translations on-demand via custom loader function when switching languages.

i18n Service API

The i18n service provides a reactive API for managing languages and locales.

Reactive Properties

PropertyTypeDescription
currentLocalestringCurrent active locale code
languagesLanguage[]Available languages list
isLoadingbooleanTrue while loading translations asynchronously
fallbackLocalestringFallback locale code
loadedLocalesSet<string>Set of loaded locale codes

Methods

MethodDescription
init(options)Initialize with options (locale, languages, translations, loader)
setLocale(code)Switch to a locale (loads async if needed)
getLanguage(code)Get language by code
isLocaleLoaded(code)Check if locale translations are loaded
setLanguages(langs)Replace the entire languages list
addLanguage(lang)Add a language to the list
removeLanguage(code)Remove a language from the list
addTranslations(code, data)Add translations for a locale
setTranslationLoader(fn)Configure the async translation loader

Language Picker Component

Build a language picker using the i18n service's reactive properties.

Tip: The i18n.isLoading property lets you show a loading indicator while translations are being fetched asynchronously.

Using Translations

Use the $_() store from svelte-i18n to translate strings in your components.

In Svelte Components (.svelte)

In Service Files (.ts)

In non-reactive contexts (like service files), use get() from svelte/store to read the translation.

Note: The $_() syntax is Svelte's store auto-subscription. It only works in .svelte files. In .ts files, use get(_) instead.

Adding App Translations

Add your own translations using the i18n service or addMessages().

Overriding Library Strings

Want to customize the library's built-in strings? Use registerLibraryTranslations().

Important: Call registerLibraryTranslations() after initI18n() to ensure your overrides take effect.

Advanced Features

Interpolation & Plurals

svelte-i18n supports ICU message format for interpolation and pluralization.

Built-in Translation Keys

Here are all the translation keys provided by the library. You can override any of these.

dialog.*
KeyEnglish DefaultDescription
dialog.confirmConfirmConfirm dialog title
dialog.cancelCancelCancel button text
dialog.okOKOK button text
dialog.alertAlertAlert dialog title
dialog.inputInputPrompt dialog title
dialog.areYouSureAre you sure?Default confirm message
dialog.enterValuePlease enter a valueDefault prompt message
dialog.defaultTitleDialogDefault dialog title
popconfirm.*
KeyEnglish DefaultDescription
popconfirm.confirmYesConfirm button text
popconfirm.cancelNoCancel button text
shortcuts.*
KeyEnglish DefaultDescription
shortcuts.titleKeyboard ShortcutsHelp dialog title
shortcuts.noShortcutsNo shortcuts registeredEmpty state message
shortcuts.generalCategoryGeneralDefault category name
shortcuts.showShortcutsShow keyboard shortcutsShortcut description
commandPalette.*
KeyEnglish DefaultDescription
commandPalette.placeholderType a command or search...Input placeholder
commandPalette.loadingLoading...Loading indicator
commandPalette.noResultsNo results foundEmpty search state
commandPalette.commandsCommandsCommands section label
commandPalette.searchSearchSearch label
loadMore.*
KeyEnglish DefaultDescription
loadMore.loadMoreLoad moreButton text
loadMore.loadingLoading...Loading state text

Type Definitions

Language

I18nInitOptions

Exports Reference

Everything you need is exported from the main package:

Adding a New Language

To add a new language to your app, you need to provide translations for all keys your app uses. You can optionally also provide translations for the library's built-in keys.

Contributing: If you add translations for a new language, consider contributing them back to the library! Create a PR with a new locales/[lang].ts file.

Keyboard Shortcuts

No shortcuts registered.