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

Add constructor option for custom modifiers #724

Merged
merged 3 commits into from
Oct 14, 2019
Merged

Add constructor option for custom modifiers #724

merged 3 commits into from
Oct 14, 2019

Conversation

epaezrubio
Copy link
Contributor

This PR adds the possibility to pass custom modifiers when creating a i18n object. It extends the functionality of #467 and the lower and upper modifiers (also called also formatters previously in the code) with whatever the user needs are.

My use case is similar to #513, since I need to sometimes capitalize my linked translation. I believe that giving the ability of extending the modifiers is the best way to go, as the need for modifier functions can be endless and doesn't make sense to support everything by default in the library.

@codecov-io
Copy link

codecov-io commented Oct 4, 2019

Codecov Report

Merging #724 into dev will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev     #724      +/-   ##
==========================================
+ Coverage   96.25%   96.26%   +0.01%     
==========================================
  Files          10       10              
  Lines         800      803       +3     
==========================================
+ Hits          770      773       +3     
  Misses         30       30
Impacted Files Coverage Δ
src/components/interpolation.js 100% <ø> (ø) ⬆️
src/index.js 97.81% <100%> (+0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e0fbaaa...182c13b. Read the comment docs.

@exoego
Copy link
Collaborator

exoego commented Oct 4, 2019

Great enhancement 👍
Could you also update type definitions in https://github.com/kazupon/vue-i18n/tree/dev/types ?

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.

Thank you for your PR!

That's awesome features!
We need the docs to use it.

Could you add the documentation, please? 🙏

@epaezrubio
Copy link
Contributor Author

I added documentation for English. I hope I did it correctly, as I found some documentation under vuepress and some under gitbook. Is the second one still maintained?

Unfortunately I can't do the Chinese translations 😞

Copy link
Collaborator

@exoego exoego left a comment

Choose a reason for hiding this comment

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

LGTM 💯

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.

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

Successfully merging this pull request may close these issues.

4 participants