[addresses] Prefer language-namespaced keys if requested
This commit is contained in:
@@ -539,12 +539,12 @@ class AddressComponents(object):
|
|||||||
else:
|
else:
|
||||||
key, raw_key = name_key, raw_name_key
|
key, raw_key = name_key, raw_name_key
|
||||||
|
|
||||||
name = component_value.get(key, component_value.get(raw_key))
|
for k in (key, name_key, raw_key, raw_name_key):
|
||||||
|
name = component_value.get(k)
|
||||||
if not name or (component != AddressFormatter.CITY and name == existing_city_name):
|
if name and not (name == existing_city_name and component != AddressFormatter.CITY):
|
||||||
name = component_value.get(name_key, component_value.get(raw_name_key))
|
break
|
||||||
|
# if we've checked all keys without finding a valid name, leave this component out
|
||||||
if not name or (component != AddressFormatter.CITY and name == existing_city_name):
|
else:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if (component, name) not in seen:
|
if (component, name) not in seen:
|
||||||
|
|||||||
Reference in New Issue
Block a user