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

Custom Message Formatter #57

Merged
merged 1 commit into from
Sep 24, 2016
Merged

Conversation

jvmccarthy
Copy link
Contributor

Allow for registering a custom message formatter function with Vue.config.i18nFormatter for more flexibility in formatting messages.

I have a requirement to use the extended Java MessageFormat spec for generically including support in the string format for dates and times. For example, imagine a message like this,

  maintenanceWarning: 'The site will be undergoing maintenance starting {0,date} at {0,time}.'

I plan to support localizing this client side using moment.js, but I need extra pluggability from vue-i18n to make this possible. By allowing for a custom formatter, vue-i18n offers greater flexibility to user needs without overloading vue-18n itself with multiple formats.

Thank you for your efforts on vue-i18n!

Allow for register a custom message formatter function with `Vue.config.i18nFormatter` for more flexibility in formatting messages.
@jvmccarthy jvmccarthy changed the title ⭐ new(config): custom message formatter custom message formatter Sep 23, 2016
@jvmccarthy jvmccarthy changed the title custom message formatter Custom Message Formatter Sep 23, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.1%) to 91.344% when pulling 39e8fcd on jvmccarthy:custom-formatter into 9586f71 on kazupon:dev.

@jvmccarthy
Copy link
Contributor Author

Looks like the build failure is due to issues with sauce labs browsers not starting and that the lines I committed were covered, so I'm not sure what the difference in code coverage is.

Let me know how I can help, thanks!

Copy link
Owner

@kazupon kazupon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understood your use-case.
awesome! 💯

@kazupon kazupon merged commit 2748eb4 into kazupon:dev Sep 24, 2016
@jvmccarthy
Copy link
Contributor Author

Thanks @kazupon for merging this in. I was just reviewing the docs again and noticed a minor typo on the API page. It should be 'custom' instead of 'customer'. My apologies. I don't think it's worth another pull request for such a minor commit. If you could tweak the file, I'd appreciate it.

Here's the changes I'm referring to, jvmccarthy@628c58c

Thanks again!

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

Successfully merging this pull request may close these issues.

3 participants