[damned-lies] Fixes bug 584470: Boldify your own language names
- From: Gil Forcada Codinachs <gforcada src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Fixes bug 584470: Boldify your own language names
- Date: Sat, 20 Aug 2011 18:11:03 +0000 (UTC)
commit cec7be325031ec570ff146e2af0e0eecce841b79
Author: Gil Forcada <gforcada gnome org>
Date: Sat Aug 20 17:31:21 2011 +0200
Fixes bug 584470: Boldify your own language names
common/utils.py | 7 +++++++
common/views.py | 5 ++---
stats/views.py | 4 +++-
templates/release_detail.html | 8 +++++++-
templates/stats_show.html | 9 ++++++++-
5 files changed, 27 insertions(+), 6 deletions(-)
---
diff --git a/common/utils.py b/common/utils.py
index f92216d..0ee700b 100644
--- a/common/utils.py
+++ b/common/utils.py
@@ -22,6 +22,7 @@
import operator
from django.conf import settings
from django.utils.translation import ugettext as _, get_language
+from languages.models import Language
try:
import PyICU
pyicu_present = True
@@ -166,6 +167,12 @@ def imerge_sorted_by_field(object_list1, object_list2, field):
def is_site_admin(user):
return user.is_superuser or settings.ADMIN_GROUP in [g.name for g in user.groups.all()]
+def get_user_locale(request):
+ curlang = Language.get_language_from_ianacode(request.LANGUAGE_CODE)
+ if curlang and curlang.locale == 'en':
+ curlang = None
+ return curlang
+
if __name__ == "__main__":
import doctest
doctest.testmod()
diff --git a/common/views.py b/common/views.py
index 74eaf04..d365ea9 100644
--- a/common/views.py
+++ b/common/views.py
@@ -31,6 +31,7 @@ from people.models import Person
from teams.models import Role
from people.forms import RegistrationForm
from languages.models import Language
+from common.utils import get_user_locale
def index(request):
""" Homepage view """
@@ -40,9 +41,7 @@ def index(request):
else:
translator_credits = translator_credits.split('\n')
- curlang = Language.get_language_from_ianacode(request.LANGUAGE_CODE)
- if curlang and curlang.locale == 'en':
- curlang = None
+ curlang = get_user_locale(request)
context = {
'pageSection': 'home',
diff --git a/stats/views.py b/stats/views.py
index b648aa1..7ba42f5 100644
--- a/stats/views.py
+++ b/stats/views.py
@@ -28,7 +28,7 @@ from django.http import HttpResponse, Http404
from django.shortcuts import render, get_object_or_404
from django.utils.translation import ugettext as _
-from common.utils import MIME_TYPES
+from common.utils import MIME_TYPES, get_user_locale
from stats.models import Statistics, FakeLangStatistics, Module, Branch, Category, Release
from stats.forms import ModuleBranchForm
from stats import utils
@@ -63,6 +63,7 @@ def module(request, module_name):
'branches': branches,
'non_standard_repo_msg' : _(settings.VCS_HOME_WARNING),
'can_edit_branches': mod.can_edit_branches(request.user),
+ 'user_language': get_user_locale(request)
}
return render(request, 'module_detail.html', context)
@@ -255,6 +256,7 @@ def release(request, release_name, format='html'):
content_type=MIME_TYPES[format])
context = {
'pageSection': "releases",
+ 'user_language': get_user_locale(request),
'release': release
}
return render(request, 'release_detail.html', context)
diff --git a/templates/release_detail.html b/templates/release_detail.html
index f6700bc..8e1f6e7 100644
--- a/templates/release_detail.html
+++ b/templates/release_detail.html
@@ -28,7 +28,13 @@
{% for lstats in release.get_global_stats %}
<tr>
<td class="leftcell">
- <a href="{% url team_slug lstats.lang_locale %}">{% trans lstats.lang_name %}</a>
+ <a href="{% url team_slug lstats.lang_locale %}">
+ {% if user_language.locale == lstats.lang_locale %}
+ <b>{% trans lstats.lang_name %}</b>
+ {% else %}
+ {% trans lstats.lang_name %}
+ {% endif %}
+ </a>
</td>
<td class="stats_numb"><a href="{% url language_release lstats.lang_locale release.name "ui" %}">
diff --git a/templates/stats_show.html b/templates/stats_show.html
index d14fe52..4ca3efa 100644
--- a/templates/stats_show.html
+++ b/templates/stats_show.html
@@ -54,7 +54,14 @@
{% for line in stat %}
{% if not forloop.first %}
<tr>
- <td class="leftcell"><a href="{% url vertimus_by_names module.name,branch.name,pot_stat.domain.name,line.language.locale %}">{{ line.get_lang }}</a>
+ <td class="leftcell">
+ <a href="{% url vertimus_by_names module.name,branch.name,pot_stat.domain.name,line.language.locale %}">
+ {% if user_language.locale == line.language.locale %}
+ <b>{{ line.get_lang }}</b>
+ {% else %}
+ {{ line.get_lang }}
+ {% endif %}
+ </a>
{% with line.most_important_message as msg %}
{% if msg %}
<img src="{{ msg.get_icon }}" title="{{ msg.get_description }}" alt="{{ msg.type }}" />
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]