Skip to content

Commit

Permalink
Fix overgeneration of translated keys
Browse files Browse the repository at this point in the history
  • Loading branch information
matthias-ronge committed Oct 31, 2024
1 parent 38dae76 commit fe389e9
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,17 @@ private static Map<String, Collection<String>> getRulesetLabelMap(String file) {
String ruleset = FileUtils.readFileToString(rulesetFile, StandardCharsets.UTF_8);
rulesetLabelMap = new HashMap<>();
Matcher keysMatcher = RULESET_KEY_PATTERN.matcher(ruleset);
Set<String> labels = new HashSet<>();
while (keysMatcher.find()) {
String key = normalize(keysMatcher.group(1));
Matcher labelMatcher = RULESET_LABEL_PATTERN.matcher(keysMatcher.group(2));
Set<String> labels = new HashSet<>();
while (labelMatcher.find()) {
labels.add(normalize(labelMatcher.group(1)));
}
rulesetLabelMap.put(key, labels);
if (logger.isTraceEnabled()) {
logger.trace("- {} -> {}", key, String.join(", ", labels));
}
}
rulesetCache.put(file, rulesetLabelMap);
return rulesetLabelMap;
Expand Down

0 comments on commit fe389e9

Please sign in to comment.