9472: Use first matching name when generating place titles
This commit is contained in:
parent
14dc963f3d
commit
0801ef1b30
@ -53,16 +53,14 @@ 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):
|
||||||
local_name = '?'
|
names = {}
|
||||||
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()
|
name_lang = place_name.get_language()
|
||||||
if name_lang == '':
|
if name_lang not in names:
|
||||||
local_name = place_name.get_value()
|
names[name_lang] = place_name.get_value()
|
||||||
if place_name.get_language() == lang:
|
return names.get(lang, names.get('', '?'))
|
||||||
return place_name.get_value()
|
|
||||||
return local_name
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user