-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
Allowing LocaleMessage to be Functions #969
Comments
Yeah, seems like a good idea. Is it doable? |
It could mostly be useful to handle complex grammar rules in some languages such as gender (masculine/feminine) that we find in Latin languages. |
Great thanks for proposal! |
Hmm, 🤔 vue-i18n-next compiles the locale text messages into functions to improve performance. code generate example: https://github.com/intlify/vue-i18n-next/blob/master/test/message/__snapshots__/compiler.test.ts.snap |
@kazupon Should two PRs be done? One for this repo and on for vue-i18n-next? |
This proposal is good too me, because it will be fully customizable for each language. To adopt this proposal into vue-i18n, I will try to think in a bit of function I/O specs, in order to maintain compatibility with vue-i18n-next. In any case, this proposal was a good inspiration for the vue-i18n-next compiler like the Vue render functions. |
I've implemented the message function. You can find the type definitions (message function I/O) of this function here. For about use case, please see this tests. Basically, I just ported from message function which is implemented in vue-i18n-next. Feedback, welcome :) |
I am trying to do something pretty complex. Here is an example that I have in French of different translations:
As you can see, the article preceding the noun will vary based on gender and phonetics.
Proposal
If we could have functions as a LocaleMessage, it would allow doing these more complex translations.
Example
Thoughts? Comments?
The text was updated successfully, but these errors were encountered: