private void preloadBundles()

in src/main/java/org/apache/sling/i18n/impl/JcrResourceBundleProvider.java [626:653]


    private void preloadBundles() {
        if (this.preloadBundles) {
            try ( final ResourceResolver resolver = createResourceResolver() ) {
                final Iterator<Map<String, Object>> bundles = resolver.queryResources(
                    JcrResourceBundle.QUERY_LANGUAGE_ROOTS, "xpath");
                final Set<Key> usedKeys = new HashSet<>();
                while (bundles.hasNext()) {
                    final Map<String,Object> bundle = bundles.next();
                    if (bundle.containsKey(PROP_LANGUAGE) && bundle.containsKey(PROP_PATH)) {
                        final String path = bundle.get(PROP_PATH).toString();
                        final String language = bundle.get(PROP_LANGUAGE).toString();
                        if (this.pathFilter.includePath(path)) {
                            final Locale locale = toLocale(language);
                            final String baseName = bundle.containsKey(PROP_BASENAME) ? bundle.get(PROP_BASENAME).toString() : null;
                            final Key key = new Key(baseName, locale);
                            if (usedKeys.add(key)) {
                                getResourceBundleInternal(resolver, baseName, locale);
                            }
                        } else {
                            log.warn("Ignoring i18n bundle for language {} at {} because it is not included by the path filter", language, path);
                        }
                    }
                }
            } catch ( final LoginException le) {
                log.error("Unable to create service user resource resolver.", le);
            }
        }
    }