feat(i18n): allow cookie links translation#324
Conversation
|
Hi @dargmuesli, up on this PR :) |
There was a problem hiding this comment.
Pull request overview
This PR aims to make the “privacy/terms” cookie links accessible in multilingual apps by allowing link labels to be configured as Translatable values and resolving the correct label at runtime.
Changes:
- Extend
Cookie.linksto acceptTranslatable(in module option types). - Add an optional fallback behavior to
resolveTranslatable()and use it when rendering cookie link labels. - Update the playground config with translated link-label examples; ignore PhpStorm
.ideafiles.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
src/types.ts |
Extends Cookie.links typing to support translated link labels. |
src/runtime/methods.ts |
Adds a useFallback parameter to resolveTranslatable() to attempt a fallback locale. |
src/runtime/components/CookieControl.vue |
Uses resolveTranslatable() to render translated link labels in the modal UI. |
playground/nuxt.config.ts |
Demonstrates translated and missing-translation link-label configurations. |
.gitignore |
Adds .idea to ignored files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
Hi, I pushed the requested changes |
dargmuesli
left a comment
There was a problem hiding this comment.
Thank you for your changes! 💚 The merge conflict can be resolved as indicated by the comments on the types file. I think the pipeline should turn green too then.
|
Hey @Cameros-agency, would you resolve the merge conflict? See #326 for context. |
I started an issue before making that PR : #322
📚 Description
There is an accessibility issue on the text shown in the privacy links.
Actually, only one language can be setup for those text. My PR is about allowing multiple translations to be setup.
About my changes :
I edited the function
methods.ts:resolveTranslatable()to use the fallback string.I then used the method to translate the texts in CookieControl.vue.