in src/main/java/org/apache/sling/i18n/impl/JcrResourceBundle.java [335:380]
private Set<String> loadPotentialLanguageRoots(
final ResourceResolver resourceResolver,
final Locale locale,
final String baseName,
final Collection<LocatorPaths> locatorPaths,
final PathFilter filter) {
final Set<String> paths = new LinkedHashSet<>();
PotentialLanguageRootCheck check = new PotentialLanguageRootCheck(baseName, locale);
// first consider resource bundles in the JCR repository
final Iterator<Resource> bundles = resourceResolver.findResources(QUERY_LANGUAGE_ROOTS, "xpath");
while (bundles.hasNext()) {
final Resource bundle = bundles.next();
if (check.isResourceBundle(bundle)) {
if (filter.includePath(bundle.getPath())) {
paths.add(bundle.getPath());
} else {
log.warn(
"Ignoring i18n bundle for language {} at {} because it is not included by the path filter",
locale,
bundle.getPath());
}
}
}
if (locatorPaths != null && !locatorPaths.isEmpty()) {
// next traverse the ancestors of all of the locator paths
final LocatorPathsVisitor visitor = new LocatorPathsVisitor(check, paths);
for (final LocatorPaths locator : locatorPaths) {
if (filter.includePath(locator.getPath())) {
final Resource parentResource = resourceResolver.getResource(locator.getPath());
if (parentResource != null) {
visitor.accept(parentResource, locator.getTraverseDepth());
}
} else {
log.warn(
"Ignoring i18n bundle for language {} at {} because it is not included by the path filter",
locale,
locator.getPath());
}
}
}
return Collections.unmodifiableSet(paths);
}