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

[Feature] Pass key instead of localised text for all text parameters #64

Open
kktos opened this issue Dec 5, 2022 · 2 comments
Open
Labels
Feature Type: New Feature

Comments

@kktos
Copy link

kktos commented Dec 5, 2022

What problem does this feature solve?

As all our texts are localized (because they have to), therefore we have to use the global function $t() for all our text parameters.

What is your idea for solve this issue

We may pass keys directly rather than the localised text.

For instance, insteas of this

<Tooltip :text="$t('ONE.TWO.TOOLTIP')"  />

we could have

<Tooltip :text="ONE.TWO.TOOLTIP"  />

This is true for all components and all the text parameters.

  • It is a syntaxic sugar
  • It allows to avoid repeat of $t()
  • It's a strong reminder that all the texts should be localised.
@kktos kktos added the Feature Type: New Feature label Dec 5, 2022
@kktos kktos changed the title [Feature] [Feature] Pass key instead of localised text for all text parameters Dec 5, 2022
@amaury-hanser
Copy link
Contributor

Hello,
How would you handle more complex cases where you need interpolation, either array or object based?

Something like:
{{ $t('message.hello', ['hello']) }}

@kktos
Copy link
Author

kktos commented Dec 5, 2022

Either as is

<Tooltip :text="$t('message.hello', ['hello'])"  />

Or there is a way to pass an object instead of a string... but can't see it from the top of my head.
Also, I don't know if it's worth investigating further. I'm saying that because in our project, only 1 or 2 texts are with parameters. All the others are a straight key.

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

No branches or pull requests

2 participants