9813: Modify endonym handling in place displayer

If no language code is matched, the default name is now the first
in the list, rather than a name with no language code.
This commit is contained in:
Nick Hall 2016-12-09 19:07:04 +00:00
parent 176fcae6ad
commit 772265c3ef

View File

@ -53,14 +53,15 @@ def get_location_list(db, place, date=None, lang=''):
return lines
def __get_name(place, date, lang):
names = {}
endonym = None
for place_name in place.get_all_names():
name_date = place_name.get_date_object()
if name_date.is_empty() or date.match_exact(name_date):
name_lang = place_name.get_language()
if name_lang not in names:
names[name_lang] = place_name.get_value()
return names.get(lang, names.get('', '?'))
if place_name.get_language() == lang:
return place_name.get_value()
if endonym is None:
endonym = place_name.get_value()
return endonym if endonym is not None else '?'
#-------------------------------------------------------------------------
#