Skip to content

feat(plugin-search): add full translation support#16802

Open
MrFlathill wants to merge 1 commit into
payloadcms:mainfrom
MrFlathill:feat/plugin-search-translations
Open

feat(plugin-search): add full translation support#16802
MrFlathill wants to merge 1 commit into
payloadcms:mainfrom
MrFlathill:feat/plugin-search-translations

Conversation

@MrFlathill
Copy link
Copy Markdown

What?

This change integrates the new @payloadcms/translations package, enabling full internationalization for the search plugin's administrative interface.

Why

To enhance the plugin's usability and accessibility for a global audience by providing its administrative interface in multiple languages. This change allows developers to easily translate all user-facing strings within the plugin-search functionality, ensuring a consistent and localized experience.

How?

  • Translation Integration: The @payloadcms/translations package is now a dependency of plugin-search.
  • Translatable UI Elements: All collection labels, field labels (label), and descriptions within the Search collection are updated to use translation functions (({ t }) => t('plugin-search:key')) instead of hardcoded strings.
  • Plugin Translations Registered: The plugin's default translations (English, German, Italian) are automatically merged into the Payload config's i18n settings.
  • Translation Export: The plugin's translations are exported as searchTranslations for external use.
  • UI Field Component Update: The LinkToDoc UI field is updated to be a UIFieldServerComponent, allowing its label to be translated server-side and passed to the client component.
  • Test Suite Enhancements: The plugin-search test environment now includes seed data for pages and posts collections, which is essential for thoroughly testing the plugin's functionality, including its newly translatable elements.
  • Removing unused dependencies

Testing

  • pnpm build:plugin-search
  • pnpm --filter @payloadcms/plugin-search build
  • pnpm test:int ./test/plugin-search/int.spec.ts
  • Manually tested the plugin with pnpm dev plugin-search , with German and Italian admin i18n and verified plugin translation keys can be resolved and overridden.

This change integrates the new `@payloadcms/translations` package, enabling full internationalization for the search plugin's administrative interface.

To enhance the plugin's usability and accessibility for a global audience by providing its administrative interface in multiple languages. This change allows developers to easily translate all user-facing strings within the `plugin-search` functionality, ensuring a consistent and localized experience.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant