Commit cec7be32 authored by Gil Forcada's avatar Gil Forcada

Fixes bug 584470: Boldify your own language names

parent c74c4700
......@@ -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()
......@@ -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',
......
......@@ -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)
......
......@@ -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" %}">
......
......@@ -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 }}" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment