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:
parent
176fcae6ad
commit
772265c3ef
@ -53,14 +53,15 @@ def get_location_list(db, place, date=None, lang=''):
|
|||||||
return lines
|
return lines
|
||||||
|
|
||||||
def __get_name(place, date, lang):
|
def __get_name(place, date, lang):
|
||||||
names = {}
|
endonym = None
|
||||||
for place_name in place.get_all_names():
|
for place_name in place.get_all_names():
|
||||||
name_date = place_name.get_date_object()
|
name_date = place_name.get_date_object()
|
||||||
if name_date.is_empty() or date.match_exact(name_date):
|
if name_date.is_empty() or date.match_exact(name_date):
|
||||||
name_lang = place_name.get_language()
|
if place_name.get_language() == lang:
|
||||||
if name_lang not in names:
|
return place_name.get_value()
|
||||||
names[name_lang] = place_name.get_value()
|
if endonym is None:
|
||||||
return names.get(lang, names.get('', '?'))
|
endonym = place_name.get_value()
|
||||||
|
return endonym if endonym is not None else '?'
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user