Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use component interpolation for array (multiple) translations #1681

Open
3 tasks done
dword-design opened this issue Aug 30, 2023 · 0 comments
Open
3 tasks done
Labels
Status: Proposal Request for comments

Comments

@dword-design
Copy link

Clear and concise description of the problem

I have a list of paragraphs that I want to translate and render each one with a <p>. But some have a link in it that I want to inject via component interpolation like this:

// en.js
{
  paragraphs: [
    'foo bar {link}',
    'another paragraph',
  ],
}
// index.vue
<!-- how to render this for each paragraph -->
<i18n-t tag="p" keypath="paragraphs">
  <template #link><a href="link" /></template>
</i18n-t>

It is possible to get the array of translations via $tm, but how to interpolate each translation?

Suggested solution

Maybe there is already a solution that I don't know of. Can I maybe iterate over $tm and interpolate each translated string individually?

Alternative

No response

Additional context

No response

Validations

@dword-design dword-design added the Status: Proposal Request for comments label Aug 30, 2023
@dword-design dword-design changed the title How to use component interpolation for array translations How to use component interpolation for array (multiple) translations Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Proposal Request for comments
Projects
None yet
Development

No branches or pull requests

1 participant