Skip to content

Internationalisation (i18n)

Search Index uses Craft's translation system with the plugin domain search-index.

Key style

Use semantic keys, not literal English phrases, in all Craft::t() and Twig |t() calls.

Examples:

Craft::t('search-index', 'errors.indexNotFound')
Craft::t('search-index', 'actions.saveAndContinueEditing')
Craft::t('search-index', 'labels.relevance')
{{ 'labels.searchIndexes'|t('search-index') }}
{{ 'errors.validationFailed'|t('search-index') }}

Namespaces

Group keys by intent:

  • actions.*: button/link verbs (actions.search, actions.saveMappings)
  • errors.*: failures and validation messages (errors.invalidEngineType)
  • help.*: long helper or instructional copy
  • labels.*: field labels/headings
  • states.*: dynamic state/status text

Translation file

English defaults live at:

  • src/translations/en/search-index.php

Add other locales using the same key set:

  • src/translations/fr/search-index.php
  • src/translations/de/search-index.php
  • etc.

Why semantic keys

  • Text can change without touching application code.
  • Translators work with stable keys and clearer intent.
  • Duplicate strings are reused consistently.
  • Refactors are safer than phrase-based lookup.

Migration note

As of 0.0.16, plugin-domain translations were migrated from phrase keys to semantic keys across PHP and Twig/Sprig templates.