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

Translations are not refreshed without full server restart #2554

Closed
Legioth opened this issue Jun 19, 2024 · 3 comments
Closed

Translations are not refreshed without full server restart #2554

Legioth opened this issue Jun 19, 2024 · 3 comments

Comments

@Legioth
Copy link
Member

Legioth commented Jun 19, 2024

Describe the bug

Changes to translation files are not picked up by a regular redeploy but only after the server is restarted.

Expected-behavior

Expected that I can update translations while developing without having to constantly restart the server.

Reproduction

  1. Download a "Hello World Project" with Hilla / React from start.vaadin.com
  2. Import into an IDE (I used VS Code) an launch Application.java
  3. Enable the Hilla I18n feature flag (I did it through Copilot) and restart the server
  4. Add vaadin-i18n/translations_en.properties containing a single line: greeting = Hello in English.
  5. Add await i18n.configure({language: "en"}); to @layout.tsx
  6. Change the button label in @index.tsx to {translate("greeting")}
  7. Observe that the translation is used
  8. Change the translation file to greeting = Hello in English2
  9. Observe that the server redeployed and that the page is reloaded in the browser, but the button text keeps using the old translation.
  10. Restart the server. Observe that the new translation is now used.

System Info

Vaadin 24.4.3

@Legioth Legioth added bug Something isn't working hilla Issues related to Hilla labels Jun 19, 2024
@cromoteca
Copy link
Contributor

I debugged the application using Spring Dev Tools and I see that in DefaultI18NProvider::getBundle the class loader is AppClassLoader and not the restart classLoader that should allow to reload the file.

@mcollovati
Copy link
Contributor

For Spring applications, the default I18NProvider bean is created by DefaultI18NProviderFactory, providing its classloader (DefaultI18NProviderFactory.class.getClassLoader()) to the DefaultI18NProvider constructor.

@platosha platosha self-assigned this Aug 14, 2024
platosha added a commit to vaadin/flow that referenced this issue Aug 15, 2024
ResourceBundle caches resources internally, this affects translation resources for the I18n feature. However, after a hot reload of a SpringBoot application in dev mode, up-to-date translations are expected in the output.

With this change, a RestartClassLoader is used in SpringBoot applications for loading translation ResourceBundle, so that the translation bundles are reloaded on hot reload.

Fixes vaadin/hilla#2554
platosha added a commit to vaadin/flow that referenced this issue Aug 21, 2024
ResourceBundle caches resources internally, this affects translation resources for the I18n feature. However, after a hot reload of a SpringBoot application in dev mode, up-to-date translations are expected in the output.

With this change, a RestartClassLoader is used in SpringBoot applications for loading translation ResourceBundle, so that the translation bundles are reloaded on hot reload.

Fixes vaadin/hilla#2554
vaadin-bot pushed a commit to vaadin/flow that referenced this issue Aug 23, 2024
…19791)

ResourceBundle caches resources internally, this affects translation resources for the I18n feature. However, after a hot reload of a SpringBoot application in dev mode, up-to-date translations are expected in the output.

With this change, a RestartClassLoader is used in SpringBoot applications for loading translation ResourceBundle, so that the translation bundles are reloaded on hot reload.

Fixes vaadin/hilla#2554
vaadin-bot added a commit to vaadin/flow that referenced this issue Aug 23, 2024
…19791) (#19821)

ResourceBundle caches resources internally, this affects translation resources for the I18n feature. However, after a hot reload of a SpringBoot application in dev mode, up-to-date translations are expected in the output.

With this change, a RestartClassLoader is used in SpringBoot applications for loading translation ResourceBundle, so that the translation bundles are reloaded on hot reload.

Fixes vaadin/hilla#2554

Co-authored-by: Anton Platonov <[email protected]>
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.4.11.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants