Skip to content
Customization

Translations

Translate every string in the bar with ready-made locales, or reword any label.

Every string Qikbar shows (placeholders, section titles, built-in actions, empty states, the AI chat) comes from a labels object. Pass a bundled locale, or override only the strings you want.

import { createQikbar } from '@qikbar/qikbar'
import { de } from '@qikbar/qikbar/locales'

createQikbar({ labels: de })

Bundled locales: en, es, fr, de, pt, it, nl, ja, zh and ko. They live in their own entry point, so they never add to your bundle unless you import them.

Follow the browser’s language

import { localeFor } from '@qikbar/qikbar/locales'

createQikbar({ labels: localeFor(navigator.language) })

localeFor('pt-BR') returns Portuguese; unknown languages fall back to English.

Reword a few strings

labels is a partial object, so you can rename things without translating everything:

createQikbar({
  labels: {
    placeholder: 'Search Acme…',
    askAi: 'Ask {ai}',
    pinned: 'Favorites',
  },
})

Labels can contain placeholders in braces, filled in at render time: {query}, {ai} (the AI’s name), {title}, {count}, {name}, {field}, {alias} and {tool}. Keep them when you translate. Mix a locale with overrides by spreading it:

import { fr } from '@qikbar/qikbar/locales'

createQikbar({ labels: { ...fr, placeholder: 'Rechercher dans Acme…' } })

Change language at runtime

bar.configure({ labels: es })

Your own strings

Your commands, sections and actions are your strings: translate them with whatever i18n library your app already uses. Inside a command, ctx.labels holds the active labels if you want to reuse them, for example in a toast:

run: async (ctx) => {
  const ok = await ctx.copy(url)
  ctx.toast({ title: ok ? ctx.labels.copied : ctx.labels.copyFailed })
}

The built-in action.copy(), action.open() and action.navigate() helpers translate themselves, unless you pass your own title.

Adding a language

The Labels type lists every key. Copy the English object from src/core/labels.ts and translate it; TypeScript tells you if a key is missing. Pull requests with new locales are welcome.

Edit this page on GitHub