-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 request: t-helper for vue-intl #3444
Comments
See also #2476. |
I'm kinda coming around to this but will have to find time to implement it |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Not stale. |
hmm how do you typically specify |
Assuming that nothing has changed since I last used this library (I'm not currently doing f/end): {{ $formatMessage({defaultMessage: "All"}) }} |
Right, but the new syntax being proposed with $t seems to be slightly different where 1st arg is the id? |
Ya, I had suggested something similar, which also included the default message. I don't really like the {{ $fm({default: "default-message"}, {value: 123}) }} Using an ID: {{ $fm({id: "one"}, {foo: "bar"}) }} (I prefer |
It would be nice to have a t-helper function for code like this:
😍
$t('one')
$t('two', { foo: 'bar' })
instead of:😢
$formatMessage({ id: 'one' })
$formatMessage({ id: 'two' }, { foo: 'bar' })
Something like this seems to be enough:
app.config.globalProperties.$t = (id, values) => intl.formatMessage({ id }, values);
This would be in line with Ember's implementation.
https://ember-intl.github.io/ember-intl/docs/helpers/t
The text was updated successfully, but these errors were encountered: