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 translate a component attribute/property #128

Open
drtobbyas opened this issue Nov 16, 2020 · 0 comments
Open

How to translate a component attribute/property #128

drtobbyas opened this issue Nov 16, 2020 · 0 comments

Comments

@drtobbyas
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant