Skip to content

Commit

Permalink
fix: Clear resource bundle cache on resource redeployment
Browse files Browse the repository at this point in the history
Allows translations to be reloaded in development mode

For #20118
  • Loading branch information
Artur- committed Oct 4, 2024
1 parent 430c40f commit 9e1e1e6
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -165,13 +166,14 @@ public void onHotswap(URI[] createdResources, URI[] modifiedResources,
"Hotswap resources change event ignored because VaadinService has been destroyed.");
return;
}
// no-op for the moment, just logging for debugging purpose
// entry point for future implementations, like reloading I18n provider
if (LOGGER.isTraceEnabled()) {
LOGGER.trace(
"Created resources: {}, modified resources: {}, deletedResources: {}.",
createdResources, modifiedResources, deletedResources);
}

// Clear resource bundle cache so that translations (and other resources) are reloaded
ResourceBundle.clearCache();
}

private void onHotswapInternal(HashSet<Class<?>> classes,
Expand Down

0 comments on commit 9e1e1e6

Please sign in to comment.