Skip to content
This repository was archived by the owner on Dec 31, 2024. It is now read-only.
This repository was archived by the owner on Dec 31, 2024. It is now read-only.

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

@dword-design

Description

@dword-design

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions