[fix] toponym abbreviations after country name, may want to use it

This commit is contained in:
Al
2016-09-10 00:49:31 -04:00
parent bbc5131cb6
commit bcde9e2fe7

View File

@@ -375,6 +375,11 @@ class OpenAddressesFormatter(object):
components.pop(AddressFormatter.UNIT)
unit = None
# CLDR country name
country_name = self.cldr_country_name(country, language, configs)
if country_name:
components[AddressFormatter.COUNTRY] = country_name
for component_key in AddressFormatter.BOUNDARY_COMPONENTS:
component = components.get(component_key, None)
if component is not None:
@@ -382,11 +387,6 @@ class OpenAddressesFormatter(object):
abbreviate_prob=abbreviate_toponym_prob)
components[component_key] = component
# CLDR country name
country_name = self.cldr_country_name(country, language, configs)
if country_name:
components[AddressFormatter.COUNTRY] = country_name
# Any components specified to be added by the config (usually state)
if add_components:
for k, v in six.iteritems(add_components):