From 579425049b8893704c48a62084a969489fab42af Mon Sep 17 00:00:00 2001 From: Al Date: Fri, 17 Mar 2017 18:28:15 -0400 Subject: [PATCH] [fix] with the new CLDR transform format, reverse the lines rather than the nodes in reverse transliterators --- scripts/geodata/i18n/transliteration_rules.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/geodata/i18n/transliteration_rules.py b/scripts/geodata/i18n/transliteration_rules.py index d81359cb..da5e609d 100644 --- a/scripts/geodata/i18n/transliteration_rules.py +++ b/scripts/geodata/i18n/transliteration_rules.py @@ -601,10 +601,11 @@ def get_raw_rules_and_variables(xml, reverse=False): compound_rule = [] nodes = xml.xpath('*//tRule') - if reverse: - nodes = reversed(nodes) - queue = deque([l for n in nodes for l in (newline_regex.split(n.text) if n.text else [])]) + lines = [l for n in nodes for l in (newline_regex.split(n.text) if n.text else [])] + if reverse: + lines = reversed(lines) + queue = deque(lines) while queue: rule = queue.popleft()