Locales and localization refactor with Locales as a localizer object.

Removed auto-localization from search/search_address APIs (now explicit), simplified AddressLines to subclass List[AddressLine], made display_name a computed property in Results instead of field and removed result-localization circular dependencies
This commit is contained in:
anqixxx
2025-07-24 16:54:13 -04:00
parent b7d77b9b43
commit 6b627df4fb
10 changed files with 113 additions and 67 deletions

View File

@@ -102,11 +102,10 @@ def test_format_reverse_with_address(fmt):
rank_address=10,
distance=0.0)
]))
reverse.localize(napi.Locales())
napi.Locales().localize_results([reverse])
raw = v1_format.format_result(napi.ReverseResults([reverse]), fmt,
{'addressdetails': True})
if fmt == 'xml':
root = ET.fromstring(raw)
assert root.find('addressparts').find('county').text == 'Hello'
@@ -165,7 +164,7 @@ def test_format_reverse_geocodejson_special_parts():
distance=0.0)
]))
reverse.localize(napi.Locales())
napi.Locales().localize_results([reverse])
raw = v1_format.format_result(napi.ReverseResults([reverse]), 'geocodejson',
{'addressdetails': True})