ICU-20811 Add fields required for locale inheritance to additive mode.

This commit is contained in:
Shane Carr 2019-09-09 14:53:27 -07:00 committed by Shane F. Carr
parent c4ea7681ee
commit 1d40b8f5e8
2 changed files with 14 additions and 3 deletions

View File

@ -222,12 +222,17 @@ There are two concrete differences between additive and subtractive mode:
| | Additive | Subtractive |
|-------------------------|-------------|-------------|
| Default Feature Filter | `"exclude"` | `"include"` |
| Default Resource Filter | `"-/"` | `"+/"` |
| Default Resource Filter | `"-/"`, `"+/%%ALIAS"`, `"+/%%Parent"` | `"+/"` |
To enable additive mode, add the following setting to your filter file:
strategy: "additive"
**Caution:** If using `"-/"` or similar top-level exclusion rules, be aware of
the fields `"+/%%Parent"` and `"+/%%ALIAS"`, which are required in locale tree
resource bundles. Excluding these paths may cause unexpected locale fallback
behavior.
#### Filter Types
You may list *filters* for each category in the *featureFilters* section of

View File

@ -319,9 +319,15 @@ class ResourceFilterInfo(object):
)
]
if self.strategy == "additive":
self.rules_by_file = [["-/"] for _ in range(len(files))]
self.rules_by_file = [
[r"-/", r"+/%%ALIAS", r"+/%%Parent"]
for _ in range(len(files))
]
else:
self.rules_by_file = [["+/"] for _ in range(len(files))]
self.rules_by_file = [
[r"+/"]
for _ in range(len(files))
]
def add_rules(self, file_filter, rules):
for file, rule_list in zip(self.input_files, self.rules_by_file):