Skip to content

Commit

Permalink
Lazy load dictionary message bundles (sites not registered upon modul…
Browse files Browse the repository at this point in the history
…e startup)
  • Loading branch information
eschleb committed Nov 21, 2024
1 parent ac81332 commit 1439f82
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public void start(ModuleLifecycleContext moduleLifecycleContext) {
LOG.info("Start Dictionary module: Load labels to dictionary");
messagesInstaller.loadLabelsToDictionary();
}
dictionaryMessageBundlesLoader.reload();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
public class DictionaryMessageBundlesLoader implements EventListener {
private static final Logger LOG = LoggerFactory.getLogger(DictionaryMessageBundlesLoader.class);
private final Provider<SystemContext> systemContextProvider;
private Map<Locale, Properties> messages = Collections.emptyMap();
private Map<Locale, Properties> messages;

@Inject
public DictionaryMessageBundlesLoader(final Provider<SystemContext> systemContextProvider) {
Expand Down Expand Up @@ -84,6 +84,9 @@ private Stream<Map.Entry<String, String>> streamMessages(final Locale locale, fi
}

public Map<Locale, Properties> getMessages() {
if(messages == null) {
reload();
}
return messages;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
<name>i18n</name>
<version>*/*</version>
</dependency>
<dependency>
<name>site</name>
<version>*</version>
<optional>true</optional>
</dependency>
<dependency>
<name>multisite</name>
<version>*</version>
<optional>true</optional>
</dependency>
</dependencies>

<repositories>
Expand Down

0 comments on commit 1439f82

Please sign in to comment.