-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support CLDR Plurals and per-call MessageResolver #14
Comments
Hi, thanks for filing the issue. Regarding the first point, this makes total sense, however the Change the For your second use case, the defaults provided with the library aren't meant to handle complex use cases, at its core the library just handles simple routing and locale resolution, you may extend it to accommodate your use case, by defining your own translation function: fun ApplicationCall.tr(keys: Iterable<String>, vararg args: Any = arrayOf()) =
attributes.computeIfAbsent(CallMessageResolverKey, {
/* create the appropriate message resolver */
}).t(locale, keys, *args) This should handle your use case, but let me know if I misunderstood something. You're welcome to open a PR with these changes if you'd like. I am going to implement the first one for sure but I don't know when exactly I'll have the time to do it. |
Hey, just a quick update here. About this issue and the other one I opened, I'll be working on them on the sprint starting 2nd January. I'll start looking into specific implementation details then and might pop some more messages here. |
hey, just as an update here. At the end what this library implements and what we needed for the project was too different and I couldn't integrate it into this library and ended-up just rolling our own internally. If you're interested in doing the translations in the future, I used this library here https://github.com/xyzsd/cldr-plural-rules which implements all the CLDR rules and the rest was pretty straight forward:
Good luck. |
Is your feature request related to a problem? Please describe.
Describe the solution you'd like
I would do the code and open a PR trying the best I can to not break any existing API but supporting the extra features.
class R
to define the type of plural stye to use (the current number based option/default) and CLDR based (the new option)private val CallResolverKey = AttributeKey<ResourceBundleMessageResolver?>("CallResourceBundleMessageResolver")
so that on the call tofun ApplicationCall.t(
it would delegate the to a different resolver (with a differentbaseName
)Describe alternatives you've considered
¯\_(ツ)_/¯
I don't know forking the project maybe.The text was updated successfully, but these errors were encountered: