LLM Reference

LLM Reference: Internationalization

This is a dense reference for LLMs working with Vextro’s i18n system. The i18n system controls admin UI strings (labels, buttons, messages). It is separate from per-document content localization.

Import Path

import { defineLocale, createI18n, t, getLocale, en } from 'vextro';

Types

// Complete locale -- all keys required
type VextroLocale = {
  common: Record<string, string>;
  collections: Record<string, string>;
  documents: Record<string, string>;
  auth: Record<string, string>;
  workflow: Record<string, string>;
  dashboard: Record<string, string>;
  alerts: Record<string, string>;
  sidebar: Record<string, string>;
  actions: Record<string, string>;
  activity: Record<string, string>;
  media: Record<string, string>;
  seo: Record<string, string>;
  webhooks: Record<string, string>;
  localeSwitcher: Record<string, string>;
};

// Partial overrides -- only supply what you want to change
type VextroLocaleOverrides = {
  [K in keyof VextroLocale]?: Partial<VextroLocale[K]>
};

defineLocale(overrides: VextroLocaleOverrides): VextroLocaleOverrides

Type-safe helper for locale overrides. Provides IDE autocomplete and key validation. Returns input unchanged.

import { defineLocale } from 'vextro';

const overrides = defineLocale({
  common: { save: 'Publish' },
  workflow: { draft: 'Unpublished', published: 'Live' },
});

Used in config:

import { defineVextroConfig, defineLocale } from 'vextro';

export default defineVextroConfig({
  locale: defineLocale({
    common: { save: 'Publish', saveChanges: 'Publish Changes' },
  }),
});

createI18n(options: { locale?: VextroLocale; overrides?: VextroLocaleOverrides }): VextroLocale

Merges a base locale with partial overrides. Defaults to English when no locale is specified.

import { createI18n, en } from 'vextro';

const locale = createI18n({
  locale: en,
  overrides: { common: { save: 'Publish' } },
});

t(template: string, params: Record<string, unknown>): string

String interpolation. Replaces {key} placeholders.

import { t } from 'vextro';

t('Used in {count} documents', { count: 5 });
// → "Used in 5 documents"

getLocale(config: VextroConfig): VextroLocale

Resolves the active locale from a config object. Merges config.locale with English defaults, or returns English as-is.

import { getLocale } from 'vextro';

const locale = getLocale(vextroConfig);

en: VextroLocale

The complete English locale. Import to build a fully custom locale from scratch.


Locale Sections (14 total)

SectionDescription
commonSave, Create, Delete, Search, Cancel, Loading, Error
collectionsCollection and global management labels
documentsDocument editor: info panel, timestamps, references
authSign-in page and authentication errors
workflowStatus labels: Draft, Published, Scheduled, Trashed
dashboardQuick actions, content overview, recent activity
alertsToast notifications and validation messages
sidebarNavigation: Access Control, Users, Roles, Media Library
actionsToolbar actions: Versions, Duplicate, Preview, History
activityActivity log entries: Created, Updated, Deleted
mediaMedia Library: search, sort, filters, upload
seoSEO field labels and OpenGraph metadata
webhooksWebhook configuration and event management
localeSwitcherContent localization UI: default locale, copy-from
Previous
Preview Listener