Skip to content

How to translate a component attribute/property #128

@drtobbyas

Description

@drtobbyas

How do I translate a component passed-in attribute/property. I have checked the doc and online for an example usage but can't find any. Please pardon If I may be posting this question in the wrong place.

My scenario

For instance, I have a card component that is define like this
`
// card component --- card.vue

{{title}}.

{{description}}

<script> export default { props: { title: String, description: String, }, }; </script>

`
which is being used in another component like this

`
// home page -- home.vue

{{title}}. {{description}}
<script> export default { props: { title: String, description: String, }, }; </script>

`

###The question is how do I translate title and description prop
I know I could add the translation with {{ $t("card.title")}} in the card component where the props were used but the card component we are talking about is a third-party library component which I can't fiddle with the implementation directly.

Please can you profer a solution to this as I couldn't find any usage of such in the docs. I think usage like this is very common.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions