Skip to content

Commit d5b6159

Browse files
committed
filter-resx: allow explicit includes
Some strings with names that do not end in ".Text" should be translated.
1 parent f7d4ad7 commit d5b6159

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

filter-resx

+8-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ and document type declarations too.)""")
99

1010
parser.add_argument("in_path")
1111
parser.add_argument("out_path")
12-
parser.add_argument("filter", nargs=argparse.REMAINDER,
13-
help="Additional names to filter.")
12+
parser.add_argument("--include", action='append', default=[],
13+
help="Additional names to include.")
14+
parser.add_argument("--exclude", action='append', default=[],
15+
help="Additional names to exclude.")
1416

1517
args = parser.parse_args()
1618

@@ -22,7 +24,10 @@ filtered_data_elements = []
2224
for element in root.iterfind("data"):
2325
name = element.get("name")
2426
if name:
25-
if not name.endswith(".Text") or name in args.filter:
27+
excluded = name in args.exclude
28+
included = name.endswith(".Text") or name in args.include
29+
30+
if excluded or not included:
2631
filtered_data_elements.append(element)
2732

2833
for element in filtered_data_elements:

0 commit comments

Comments
 (0)