From 772265c3ef924d19b9c446043668103a95109ea8 Mon Sep 17 00:00:00 2001 From: Nick Hall Date: Fri, 9 Dec 2016 19:07:04 +0000 Subject: [PATCH] 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. --- gramps/gen/utils/location.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/gramps/gen/utils/location.py b/gramps/gen/utils/location.py index 85f300900..42c1d5654 100644 --- a/gramps/gen/utils/location.py +++ b/gramps/gen/utils/location.py @@ -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 '?' #------------------------------------------------------------------------- #