Skip to content

Conversation

@ta-inventions
Copy link

πŸ”— Linked issue

N/A (documentation improvement)

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This PR adds documentation explaining how to add localization support to a custom Nuxt UI component using the built-in locale infrastructure.

The guide covers:

  • Extending the Messages type in runtime/types/locale.ts to define typed, optional message keys for the component
  • Adding translations in runtime/locale/* (including the required English entries)
  • Using useLocale() and t() in the component to render localized strings

No code changes.

Nuxt UI documents how to create new components, but currently lacks guidance for wiring those components into the locale infrastructure. As a result, contributors typically have to reverse-engineer the existing implementation in the codebase to add translations correctly.

This documentation reduces contributor friction, prevents inconsistent patterns, and makes localization support discoverable.

This added section to the docs allow people to quickly understand and implement a localization support for their component instead of spending time to figure it out themselves, they can use their time to: develop new features, going to the beach πŸ–οΈ, dancing in the sunπŸ’ƒπŸ•Ίβ˜€οΈ, making loveβ™₯️ etc... more productive activities

πŸ“ Checklist

  • [] I have linked an issue or discussion.
  • I have updated the documentation accordingly.
{83B2680A-7F9F-4771-8292-9E57FAA3C93C} {7E2E80B9-C2C7-49D4-ADBF-11BFC3303C24} {FDF176C7-0FA7-4A56-A22B-401F546F9FC3} {AFF1738B-BB17-422F-9EFA-260AA87D9339}

@github-actions github-actions bot added the v4 #4488 label Jan 21, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 21, 2026

npm i https://pkg.pr.new/@nuxt/ui@5915

commit: ce8fbb8

@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

πŸ“ Walkthrough

Walkthrough

This change adds a new "Add localization support for your component" section to the contribution documentation. The addition includes guidance on implementing localization for components, covering Message typing, locale file locations, a MyButton.vue example, steps for defining messages, optional constraints, translation file structure with sample translations, component usage patterns, and locale creation instructions. The content totals 84 lines and appears in two locations within the document.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

πŸš₯ Pre-merge checks | βœ… 3
βœ… Passed checks (3 passed)
Check name Status Explanation
Title check βœ… Passed The title clearly and concisely summarizes the main change: adding a component localization guide to the contribution documentation section.
Description check βœ… Passed The description is directly related to the changeset, explaining the purpose, content, and motivation for adding localization documentation to guide contributors.
Docstring Coverage βœ… Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

πŸ€– Fix all issues with AI agents
In `@docs/content/docs/1.getting-started/4.contribution.md`:
- Around line 138-147: Tighten the copy in the locale guidance by fixing small
grammar and punctuation issues: change "For Example" to "For example," ensure
"i.e:" becomes "i.e.,", normalize "Translations files" to "translation files",
and standardize spacing around colons and inline code examples (e.g., keep
`MyButton.vue` -> `myButton:` and `myButton?: {`, `buttonText?: string`,
`ariaLabel?: string`). Apply these edits in the component key explanation block
(the sentence starting with "The component key in `locale.ts`") and repeat the
same fixes for the corresponding text referenced on lines 149-151.

Comment on lines +138 to +147
The component key in `locale.ts` must match your component name in camelCase. For Example, `MyButton.vue` -> `myButton:`
::

::warning
All entries must be optional by using the `?` TypeScript annotation - i.e: `myButton?: {`, `buttonText?: string`, `ariaLabel?: string` Otherwise, you'll be required to provide translations for every supported locale.
::

::tip
You can pick any name you like for your messages. For example: `buttonText` can be `mainText` and `ariaLabel` can be `ariaText` or anything that makes sense for your component
::
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟑 Minor

Tighten grammar and punctuation in the new guidance.
These lines have small grammar/punctuation nits (β€œFor Example”, β€œi.e:”, β€œTranslations files”). Consider the edits below for clarity.

✏️ Proposed copy edits
-For Example, `MyButton.vue` -> `myButton:`
+For example, `MyButton.vue` β†’ `myButton:`

-All entries must be optional by using the `?` TypeScript annotation - i.e: `myButton?: {`, `buttonText?: string`, `ariaLabel?: string` Otherwise, you'll be required to provide translations for every supported locale.
+All entries must be optional by using the `?` TypeScript annotation β€” i.e., `myButton?: {`, `buttonText?: string`, `ariaLabel?: string`. Otherwise, you'll be required to provide translations for every supported locale.

-Translations files are located in `runtime/locale` - Add the locales you want to support for your component:
+Translation files are located in `runtime/locale` β€” add the locales you want to support for your component:

Also applies to: 149-151

πŸ€– Prompt for AI Agents
In `@docs/content/docs/1.getting-started/4.contribution.md` around lines 138 -
147, Tighten the copy in the locale guidance by fixing small grammar and
punctuation issues: change "For Example" to "For example," ensure "i.e:" becomes
"i.e.,", normalize "Translations files" to "translation files", and standardize
spacing around colons and inline code examples (e.g., keep `MyButton.vue` ->
`myButton:` and `myButton?: {`, `buttonText?: string`, `ariaLabel?: string`).
Apply these edits in the component key explanation block (the sentence starting
with "The component key in `locale.ts`") and repeat the same fixes for the
corresponding text referenced on lines 149-151.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v4 #4488

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants