From 1d40b8f5e8fc178d946199c753d05c4b5ed84857 Mon Sep 17 00:00:00 2001 From: Shane Carr Date: Mon, 9 Sep 2019 14:53:27 -0700 Subject: [PATCH] ICU-20811 Add fields required for locale inheritance to additive mode. --- docs/userguide/icu_data/buildtool.md | 7 ++++++- icu4c/source/python/icutools/databuilder/filtration.py | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docs/userguide/icu_data/buildtool.md b/docs/userguide/icu_data/buildtool.md index da4c859fa7..4262e414b0 100644 --- a/docs/userguide/icu_data/buildtool.md +++ b/docs/userguide/icu_data/buildtool.md @@ -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 diff --git a/icu4c/source/python/icutools/databuilder/filtration.py b/icu4c/source/python/icutools/databuilder/filtration.py index 9150eb28f2..0eff5b9c57 100644 --- a/icu4c/source/python/icutools/databuilder/filtration.py +++ b/icu4c/source/python/icutools/databuilder/filtration.py @@ -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):