Narrativeweb : Swedish specific alphabet sort.
svn: r12500
This commit is contained in:
parent
f18040a0d0
commit
0df89ea9b7
@ -295,6 +295,19 @@ class BasePage:
|
||||
|
||||
sorted_set = {}
|
||||
|
||||
# The comment below from the glibc locale sv_SE in
|
||||
# localedata/locales/sv_SE :
|
||||
#
|
||||
# % The letter w is normally not present in the Swedish alphabet. It
|
||||
# % exists in some names in Swedish and foreign words, but is accounted
|
||||
# % for as a variant of 'v'. Words and names with 'w' are in Swedish
|
||||
# % ordered alphabetically among the words and names with 'v'. If two
|
||||
# % words or names are only to be distinguished by 'v' or % 'w', 'v' is
|
||||
# % placed before 'w'.
|
||||
#
|
||||
# See : http://www.gramps-project.org/bugs/view.php?id=2933
|
||||
#
|
||||
(lang_country, modifier ) = locale.getlocale()
|
||||
for ltr in get_first_letters(db, handle_list, key):
|
||||
try:
|
||||
sorted_set[ltr] += 1
|
||||
@ -314,9 +327,14 @@ class BasePage:
|
||||
of.write('\t\t<ul>\n')
|
||||
for ltr in sorted_first_letter:
|
||||
title_str = _('Surnames') if key == 0 else _('Places')
|
||||
title_str += _(' starting with %s') % ltr
|
||||
of.write('\t\t\t<li class="letters"><a href="#%s" title="%s">%s</a></li>\n'
|
||||
% (ltr, title_str, ltr))
|
||||
if lang_country == "sv_SE" and ltr == u'V':
|
||||
title_str += _(' starting with %s') % "V,W"
|
||||
of.write('\t\t\t<li class="letters"><a href="#%s" title="%s">%s</a></li>\n'
|
||||
% ("V,W", title_str, "V,W"))
|
||||
else:
|
||||
title_str += _(' starting with %s') % ltr
|
||||
of.write('\t\t\t<li class="letters"><a href="#%s" title="%s">%s</a></li>\n'
|
||||
% (ltr, title_str, ltr))
|
||||
of.write('\t\t</ul>\n')
|
||||
of.write('\t</div>\n')
|
||||
else:
|
||||
@ -329,9 +347,14 @@ class BasePage:
|
||||
while (cols <= 26 and index < num_ltrs):
|
||||
letter = sorted_first_letter[index]
|
||||
title_str = _('Surnames') if key == 0 else _('Places')
|
||||
title_str += _(' starting with %s') % letter
|
||||
of.write('\t\t\t<li class="letters"><a href="#%s" title="%s">%s</a></li>\n'
|
||||
% (letter, title_str, letter))
|
||||
if lang_country == "sv_SE" and ltr == u'V':
|
||||
title_str += _(' starting with %s') % "V,W"
|
||||
of.write('\t\t\t<li class="letters"><a href="#%s" title="%s">%s</a></li>\n'
|
||||
% ("V,W", title_str, "V,W"))
|
||||
else:
|
||||
title_str += _(' starting with %s') % letter
|
||||
of.write('\t\t\t<li class="letters"><a href="#%s" title="%s">%s</a></li>\n'
|
||||
% (letter, title_str, letter))
|
||||
cols += 1
|
||||
index += 1
|
||||
of.write('\t\t<ul>\n')
|
||||
@ -830,6 +853,14 @@ class IndividualListPage(BasePage):
|
||||
|
||||
for (surname, handle_list) in person_handle_list:
|
||||
first = True
|
||||
if surname:
|
||||
letter = normalize('NFKC', surname)[0].upper()
|
||||
else:
|
||||
letter = u' '
|
||||
# See : http://www.gramps-project.org/bugs/view.php?id=2933
|
||||
(lang_country, modifier ) = locale.getlocale()
|
||||
if lang_country == "sv_SE" and ( letter == u'W' or letter == u'V' ):
|
||||
letter = u'V,W'
|
||||
for person_handle in handle_list:
|
||||
person = db.get_person_from_handle(person_handle)
|
||||
|
||||
@ -838,7 +869,7 @@ class IndividualListPage(BasePage):
|
||||
of.write('\t\t<tr class="BeginSurname">\n')
|
||||
if surname:
|
||||
of.write('\t\t\t<td class="ColumnSurname"><a name="%s">%s</a></td>\n'
|
||||
% (surname[0], surname))
|
||||
% (letter, surname))
|
||||
else:
|
||||
of.write('\t\t\t<td class="ColumnSurname"> \n')
|
||||
else:
|
||||
@ -1104,6 +1135,10 @@ class PlaceListPage(BasePage):
|
||||
continue
|
||||
|
||||
letter = normalize('NFKC', place_title)[0].upper()
|
||||
# See : http://www.gramps-project.org/bugs/view.php?id=2933
|
||||
(lang_country, modifier ) = locale.getlocale()
|
||||
if lang_country == "sv_SE" and ( letter == u'W' or letter == u'V' ):
|
||||
letter = u'V,W'
|
||||
|
||||
if letter != last_letter:
|
||||
last_letter = letter
|
||||
@ -1550,7 +1585,14 @@ class SurnameListPage(BasePage):
|
||||
|
||||
# Get a capital normalized version of the first letter of
|
||||
# the surname
|
||||
letter = normalize('NFKC', surname)[0].upper()
|
||||
if surname:
|
||||
letter = normalize('NFKC', surname)[0].upper()
|
||||
else:
|
||||
letter = u' '
|
||||
# See : http://www.gramps-project.org/bugs/view.php?id=2933
|
||||
(lang_country, modifier ) = locale.getlocale()
|
||||
if lang_country == "sv_SE" and ( letter == u'W' or letter == u'V' ):
|
||||
letter = u'V,W'
|
||||
|
||||
if letter != last_letter:
|
||||
last_letter = letter
|
||||
@ -3633,7 +3675,12 @@ def get_first_letters(db, handle_list, key):
|
||||
|
||||
if keyname:
|
||||
c = normalize('NFKC', keyname)[0].upper()
|
||||
first_letters.append(c)
|
||||
# See : http://www.gramps-project.org/bugs/view.php?id=2933
|
||||
(lang_country, modifier ) = locale.getlocale()
|
||||
if lang_country == "sv_SE" and ( c == u'W' or c == u'V' ):
|
||||
first_letters.append(u'V')
|
||||
else:
|
||||
first_letters.append(c)
|
||||
|
||||
return first_letters
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user