Ask questions and see you at December, 3rd (Sunday this time, collides with: https://www.meetup.com/airhacks/events/297554282/) 8 pm CET: youtube.com/c/bienadam
Also checkout recent episode:
Please keep the questions as short and as concise as only possible. Feel free to ask several, shorter questions. I will also cover some questions in my "shorts" youtube.com/@bienadam/shorts between the shows.
Upcoming airhacks.tv events are also going to be announced at meetup.com/airhacks
New: the airhacks.tv discord server: discord.gg/airhacks
Hi Adam.
Application:
Frontend is Vaadin 23 with CDI, JavaEE 8 backend + jax-rs web services (without spring boot) - multi module maven project
The service (interface) for getting data and bussines logic is injected (injected from BL jar module) directly into UI classes or views. The scope is @Local for service and @stateless for control.
User log in and get JWT. We can pack information about locale into JWT no problem.
As of now we set default locale in JVM. So getting translations from frontend, backend and JPA validation was not a problem because of locale.getDefault accesible everywhere in the code.
But now the requirment has changed to per user locale.
User can choose its own locale in the UI settings. Translation for the UI components like button caption etc its not a problem.
We also have *.properties (resource bundle) for translation strings by key..
Structure:
Problem #1:
How to get locale from UI user to backend (in fancy way, maybe with context or somehow) ? Also how to get translation for enums (static methods etc...) ?
We can do as new parameter to each method but that would be a lot of work for every method call in the application (not that small app).
Problem #2:
How to get JPA validation based on user locale ? On the frontend we use binder (bean validation directly from jpa entities) from vaadin most of the time for forms and such.
Problem #2:
External usage of web services (with JWT), we can pack information about locale into JWT no problem. But then the #1 and #2 problems occurs again.
I hope i provided enough information. If not maybe in next one with additional information.
Thanks for your answer. Keep up the goor work.