Open jcgueriaud1 opened 1 month ago
See here https://github.com/vaadin/flow/pull/18680#discussion_r1507403653 why it's done like this
Thanks, that's a big limitation. I have 2 languages German and English and my application is in German by default.
I don't understand German 😭
Zeit deutsch zu lernen 😉 (time to learn German)
If you switch the order of the languages.. English should be used first, or?
If you switch the order of the languages
The DefaultI18NProvider
doesn't allow you to do that. So I implemented my own which is not used
I would have expected you can register a bean like so new DefaultI18NProvider(yourLocales)
and the default bean backs off and yours would win with your locale order
That's exactly the purpose of the ticket 😄
The following should also work:
@Configuration
public class MyBeans {
@Bean
public I18NProvider myProvider() {
return new DefaultI18NProvider(List.of(Locale.GERMAN));
}
}
This workaround works in my case.
Description of the bug
It seems not possible to change the
TranslationProvider
for Hilla and use the i18n object, because theTranslationFileRequestHandler
requiresDefaultI18NProvider
https://github.com/vaadin/flow/blob/main/flow-server/src/main/java/com/vaadin/flow/i18n/TranslationFileRequestHandler.java#L72
Expected behavior
I want to be able to update the
TranslationProvider
to update the default lang or use a database.One solution could be a new interface or at least test if the
TranslationProvider
is a subclass of theDefaultI18NProvider
Minimal reproducible example
https://github.com/jcgueriaud1/spring-petclinic-vaadin-flow/tree/hybrid
And add this class:
Versions