Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #32 from hejsan/i18n
Browse files Browse the repository at this point in the history
Changed all relevant str() calls to unicode() and added a few translatio...
  • Loading branch information
superdmp committed Jan 26, 2012
2 parents 065c6ea + a882d04 commit d4d5b6b
Show file tree
Hide file tree
Showing 18 changed files with 298 additions and 62 deletions.
2 changes: 1 addition & 1 deletion contacts_and_people/admin.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def clean(self):


# set the title # set the title
title = self.cleaned_data["title"] or "" title = self.cleaned_data["title"] or ""
link_title = " ".join(name_part for name_part in [str(title), self.cleaned_data["given_name"], self.cleaned_data["surname"]] if name_part) link_title = u" ".join(name_part for name_part in [unicode(title), self.cleaned_data["given_name"], self.cleaned_data["surname"]] if name_part)


# check ExternalLink-related issues # check ExternalLink-related issues
self.cleaned_data["external_url"] = get_or_create_external_link(self.request, self.cleaned_data["external_url"] = get_or_create_external_link(self.request,
Expand Down
6 changes: 3 additions & 3 deletions contacts_and_people/link_schemas.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def description(self):
return self.obj.get_website.get_meta_description() return self.obj.get_website.get_meta_description()
# the following functionality will have to be restored in such a way that we don't return admin messages to the frontend - later # the following functionality will have to be restored in such a way that we don't return admin messages to the frontend - later
# else: # else:
# return "<span class='errornote'>The page <em>" + str(self.obj.get_website) + "</em> has no description metadata. If you are responsible for this page, please address this problem <strong>immediately.</strong></span>" # return u"<span class='errornote'>The page <em>" + unicode(self.obj.get_website) + "</em> has no description metadata. If you are responsible for this page, please address this problem <strong>immediately.</strong></span>"


def heading(self): def heading(self):
return "Related pages" return "Related pages"
Expand All @@ -61,10 +61,10 @@ def url(self):
return self.obj.get_website_url() return self.obj.get_website_url()


def text(self): def text(self):
return str(self.obj)# + ": " + self.link_attributes[0] return unicode(self.obj)# + ": " + self.link_attributes[0]


def short_text(self): def short_text(self):
return str(self.obj.short_name) return unicode(self.obj.short_name)
schema.register_wrapper([models.Entity],EntityWrapper) schema.register_wrapper([models.Entity],EntityWrapper)




Expand Down
Binary file not shown.
181 changes: 181 additions & 0 deletions contacts_and_people/locale/is/LC_MESSAGES/django.po
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,181 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-01-24 16:49+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"

#: admin.py:592
#, python-format
msgid "The %(name)s \"%(obj)s\" was added successfully."
msgstr ""

#: admin.py:600
msgid "You may edit it again below."
msgstr ""

#: admin.py:605
msgid "Add user"
msgstr "Bæta við notanda"

#: cms_plugins.py:18
msgid "Entity auto page link"
msgstr "Tengill á sjálfvirka síðu"

#: cms_plugins.py:61
msgid "Directory"
msgstr "Skrá"

#: cms_plugins.py:102
msgid "Member list"
msgstr "Listi yfir meðlimi"

#: views.py:34
msgid "All other people"
msgstr "Allir aðrir"

#: views.py:38
msgid "People"
msgstr "Fólk"

#: templates/admin/contacts_and_people/change_form__delete.html:23
#: templates/admin/contacts_and_people/person/change_form__delete.html:23
msgid "History"
msgstr "Saga"

#: templates/admin/contacts_and_people/change_form__delete.html:24
#: templates/admin/contacts_and_people/person/change_form__delete.html:24
msgid "View on site"
msgstr "Skoða á vef"

#: templates/admin/contacts_and_people/change_form__delete.html:35
#: templates/admin/contacts_and_people/person/change_form__delete.html:34
msgid "Please correct the error below."
msgid_plural "Please correct the errors below."
msgstr[0] "Vinsamlega leiðréttu villuna að neðan"
msgstr[1] "Vinsamlega leiðréttu villurnar að neðan"

#: templates/admin/contacts_and_people/entity/change_list.html:8
msgid "Home"
msgstr "Heim"

#: templates/admin/contacts_and_people/entity/change_list.html:57
msgid "Successfully moved"
msgstr "Tókst að færa"

#: templates/admin/contacts_and_people/entity/change_list.html:62
msgid "An error occured. Please reload the page"
msgstr "Villa kom upp. Vinsamlegast endurhlaðið síðuna"

#: templates/admin/contacts_and_people/entity/change_list.html:77
#, python-format
msgid "Recover deleted %(name)s"
msgstr "Endurheimta %(name)s sem hefur verið eytt"

#: templates/admin/contacts_and_people/entity/change_list.html:80
#, python-format
msgid "Add %(name)s"
msgstr "Bæta við %(name)s"

#: templates/admin/contacts_and_people/entity/change_list.html:92
msgid "Entities on:"
msgstr "Einingar á:"

#: templates/admin/contacts_and_people/entity/change_list.html:109
msgid "Filter:"
msgstr "Sía"

#: templates/admin/contacts_and_people/entity/change_list.html:109
msgid "on"
msgstr "á"

#: templates/admin/contacts_and_people/entity/change_list.html:109
msgid "off"
msgstr "af"

#: templates/admin/contacts_and_people/entity/change_list.html:111
msgid "Filter"
msgstr "Sía"

#: templates/admin/contacts_and_people/entity/change_list_tree.html:6
msgid "title"
msgstr "titill"

#: templates/admin/contacts_and_people/entity/change_list_tree.html:8
msgid "actions"
msgstr "aðgerðir"

#: templates/admin/contacts_and_people/entity/change_list_tree_item.html:10
msgid "insert above"
msgstr "setja inn fyrir ofan þessa einingu"

#: templates/admin/contacts_and_people/entity/change_list_tree_item.html:11
msgid "insert below"
msgstr "setja inn fyrir neðan þessa einingu"

#: templates/admin/contacts_and_people/entity/change_list_tree_item.html:12
msgid "insert inside"
msgstr "setja inn undir þessari einingu"

#: templates/admin/contacts_and_people/entity/change_list_tree_item.html:17
msgid "Cut"
msgstr "Klippa"

#: templates/admin/contacts_and_people/entity/change_list_tree_item.html:17
msgid "cut"
msgstr "klippa"

#: templates/admin/contacts_and_people/entity/change_list_tree_item.html:21
msgid "Add Child"
msgstr "Bæta við einingu undir þessari"

#: templates/admin/contacts_and_people/entity/change_list_tree_item.html:21
msgid "add"
msgstr "bæta við"

#: templates/admin/contacts_and_people/entity/change_list_tree_item.html:23
msgid "Delete"
msgstr "Eyða"

#: templates/admin/contacts_and_people/entity/change_list_tree_item.html:23
msgid "delete"
msgstr "eyða"

#: templates/contacts_and_people/admin/auth/user/add_form.html:5
msgid ""
"First, enter a username and password. Then, you'll be able to edit more user "
"options."
msgstr "Skráið fyrst notandanafn og lykilorð"

#: templates/contacts_and_people/admin/auth/user/add_form.html:12
msgid "Username"
msgstr "Notandanafn"

#: templates/contacts_and_people/admin/auth/user/add_form.html:19
msgid "has password"
msgstr "er með lykilorð"

#: templates/contacts_and_people/admin/auth/user/add_form.html:25
msgid "Password"
msgstr "Lykilorð"

#: templates/contacts_and_people/admin/auth/user/add_form.html:31
msgid "Password (again)"
msgstr "Lykilorð (aftur)"

#: templates/contacts_and_people/admin/auth/user/add_form.html:32
msgid "Enter the same password as above, for verification."
msgstr "Sláðu inn sama lykilorð og að ofan, til staðfestingar"
18 changes: 9 additions & 9 deletions contacts_and_people/models.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ class Meta:


def __unicode__(self): def __unicode__(self):
if self.name: if self.name:
building_identifier = str(self.site) + ": " + self.name building_identifier = unicode(self.site) + ": " + self.name
elif self.street: elif self.street:
building_identifier = str(self.site) + ": " + self.number + " " + self.street building_identifier = unicode(self.site) + ": " + self.number + " " + self.street
else: else:
building_identifier = str(self.site) + ": " + self.postcode building_identifier = unicode(self.site) + ": " + self.postcode
return building_identifier return building_identifier


def get_absolute_url(self): def get_absolute_url(self):
Expand All @@ -114,7 +114,7 @@ def get_name(self):
elif self.street: elif self.street:
building_identifier = self.number + " " + self.street building_identifier = self.number + " " + self.street
else: else:
building_identifier = str(self.site) + ": " + self.postcode building_identifier = unicode(self.site) + ": " + self.postcode
return building_identifier return building_identifier


def get_postal_address(self): def get_postal_address(self):
Expand Down Expand Up @@ -205,7 +205,7 @@ class EntityLite(models.Model):
name = models.CharField(max_length=100, help_text="e.g. Section of Haematology") name = models.CharField(max_length=100, help_text="e.g. Section of Haematology")


def __unicode__(self): def __unicode__(self):
return str(self.name) return unicode(self.name)




class EntityManager(models.Manager): class EntityManager(models.Manager):
Expand Down Expand Up @@ -510,7 +510,7 @@ class PersonLite(models.Model):
surname = models.CharField(max_length=50) surname = models.CharField(max_length=50)


def __unicode__(self): def __unicode__(self):
return str(self.given_name + " " + self.middle_names + " " + self.surname) return unicode(self.given_name + " " + self.middle_names + " " + self.surname)


def __getInitials(self): def __getInitials(self):
if self.given_name <> '' and self.middle_names <> '': if self.given_name <> '' and self.middle_names <> '':
Expand Down Expand Up @@ -556,7 +556,7 @@ class Meta:


def __unicode__(self): def __unicode__(self):
title = self.title or "" title = self.title or ""
return " ".join(name_part for name_part in [str(title), self.given_name, self.surname] if name_part) return u" ".join(name_part for name_part in [unicode(title), self.given_name, self.surname] if name_part)


def get_absolute_url(self): def get_absolute_url(self):
if self.external_url: if self.external_url:
Expand Down Expand Up @@ -683,9 +683,9 @@ class Meta:


def __unicode__(self): def __unicode__(self):
if self.display_role: if self.display_role:
return str(self.entity.short_name) + "-" + str(self.display_role) return unicode(self.entity.short_name) + "-" + unicode(self.display_role)
else: else:
return str(self.role) return unicode(self.role)


def save(self): def save(self):
""" """
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<h{{ IN_BODY_HEADING_LEVEL }}>All people A-Z by surname</h{{ IN_BODY_HEADING_LEVEL }}> <h{{ IN_BODY_HEADING_LEVEL }}>All people A-Z by surname</h{{ IN_BODY_HEADING_LEVEL }}>
<ul class= "index"> <ul class= "index">
{% for initial in initials_list %} {% for initial in initials_list %}
<li><a href="/people/{{ entity.slug }}/{{initial|lower}}/">{{ initial }}</a></li> <li><a href="/people/{{ entity.slug }}/{{initial|lower|urlencode}}/">{{ initial }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
var infowindow = null; var infowindow = null;


function initialize() { function initialize() {
var latlng = new google.maps.LatLng({{ place.latitude }}, {{place.longitude}}); var latlng = new google.maps.LatLng({{ place.latitude|stringformat:"f" }}, {{ place.longitude|stringformat:"f" }});


var myOptions = { var myOptions = {
panControl: false, panControl: false,
Expand Down Expand Up @@ -46,7 +46,7 @@


{% if p.latitude and p.longitude and p.zoom and p.map %} {% if p.latitude and p.longitude and p.zoom and p.map %}


var siteLatLng = new google.maps.LatLng({{p.latitude}}, {{p.longitude}}); var siteLatLng = new google.maps.LatLng({{ p.latitude|stringformat:"f" }}, {{ p.longitude|stringformat:"f" }});


latlngbounds.extend(siteLatLng); latlngbounds.extend(siteLatLng);


Expand Down Expand Up @@ -84,6 +84,7 @@


map.fitBounds( latlngbounds ); map.fitBounds( latlngbounds );



return pMarker; return pMarker;
} }
</script> </script>
Expand Down
2 changes: 1 addition & 1 deletion contacts_and_people/urls.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
(r"^place/(?P<slug>[-\w]+)/(?P<active_tab>[-\w]*)/?$", "contacts_and_people.views.place"), (r"^place/(?P<slug>[-\w]+)/(?P<active_tab>[-\w]*)/?$", "contacts_and_people.views.place"),


# lists of people in an entity # lists of people in an entity
(r"^people/(?P<slug>[-\w]+)/(?P<letter>[a-z])/$", "contacts_and_people.views.people"), (r"^people/(?P<slug>[-\w]+)/(?P<letter>\w)/$", "contacts_and_people.views.people"),
(r"^people/(?P<slug>[-\w]+)/$", "contacts_and_people.views.people"), (r"^people/(?P<slug>[-\w]+)/$", "contacts_and_people.views.people"),


# main contacts & people page # main contacts & people page
Expand Down
19 changes: 10 additions & 9 deletions contacts_and_people/views.py
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.utils.translation import ugettext_lazy as _
import django.http as http import django.http as http
from django.template import RequestContext from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404 from django.shortcuts import render_to_response, get_object_or_404
Expand Down Expand Up @@ -30,11 +31,11 @@ def contacts_and_people(request, slug=getattr(default_entity, "slug", None)):
people, initials = entity.get_people_and_initials() people, initials = entity.get_people_and_initials()
# are there Key People to show? # are there Key People to show?
if entity.get_key_people(): # if so we will show a list of people with key roles, then a list of other people if entity.get_key_people(): # if so we will show a list of people with key roles, then a list of other people
people_list_heading = "All other people" people_list_heading = _(u"All other people")
# now remove the Key People from the people list # now remove the Key People from the people list
people = [ person for person in people if person not in set([role.person for role in entity.get_key_people()])] people = [ person for person in people if person not in set([role.person for role in entity.get_key_people()])]
else: # otherwise, just a list of the people with roles else: # otherwise, just a list of the people with roles
people_list_heading = "People" people_list_heading = _(u"People")
people = entity.get_roles_for_members(people) # convert the list of Persons into a list of Members people = entity.get_roles_for_members(people) # convert the list of Persons into a list of Members


return render_to_response( return render_to_response(
Expand Down Expand Up @@ -71,14 +72,14 @@ def people(request, slug, letter=None):
main_page_body_file = "includes/people_list_with_index.html" main_page_body_file = "includes/people_list_with_index.html"
# meta values - title and meta # meta values - title and meta
meta = { meta = {
"description": "People in %s" % entity, u"description": "People in %s" % entity,
} }
title = "%s: people" % entity title = u"%s: people" % entity
# content values # content values
people, initials = entity.get_people_and_initials() people, initials = entity.get_people_and_initials()
if letter: if letter:
people = entity.get_people(letter) people = entity.get_people(letter)
title = "%s, people by surname: %s" % (entity, letter.upper()) title = u"%s, people by surname: %s" % (entity, letter.upper())
return render_to_response( return render_to_response(
"contacts_and_people/arkestra_page.html", "contacts_and_people/arkestra_page.html",
{ {
Expand Down Expand Up @@ -157,13 +158,13 @@ def person(request, slug, active_tab=""):
"tab": "research", "tab": "research",
"title": "Research", "title": "Research",
"address": "research", "address": "research",
"meta_description_content": str(person) + "- research interests", "meta_description_content": unicode(person) + "- research interests",
}, },
"publications": { "publications": {
"tab": "publications", "tab": "publications",
"title": "Publications", "title": "Publications",
"address": "publications", "address": "publications",
"meta_description_content": str(person) + "- publications", "meta_description_content": unicode(person) + "- publications",
}, },
} }


Expand Down Expand Up @@ -352,8 +353,8 @@ def ajaxGetMembershipForPerson(request):
else: else:
is_selected = "" is_selected = ""
#return an <option> entry for that membership #return an <option> entry for that membership
response.write('<option ' + is_selected + ' value="' + str(membership.id) + '">' + \ response.write('<option ' + is_selected + ' value="' + unicode(membership.id) + '">' + \
str(membership.entity) + ' - ' + str(membership.role) + \ unicode(membership.entity) + ' - ' + unicode(membership.role) + \
'</option>') '</option>')
#Done #Done
return response return response
2 changes: 1 addition & 1 deletion housekeeping/clean_plugins.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def clean(request, slug = "dryrun"):
modified_soup = True modified_soup = True
if modified_soup: if modified_soup:
modified= True modified= True
plugin.body = str(soup) plugin.body = unicode(soup)




if execute and modified: if execute and modified:
Expand Down
Loading

0 comments on commit d4d5b6b

Please sign in to comment.