Commit 14443bcf authored by Michal Čihař's avatar Michal Čihař

Add tab showing other usages of the string

parent 208997c7
{% load i18n %}
{% load weblate %}
{% if other %}
<table>
<thead>
<tr><th>{% trans "Project "%}</th><th>{% trans "Source" %}</th><th>{% trans "Translation" %}</th></tr>
</thead>
<tbody>
{% for item in other %}
<tr>
<td>{{ item.translation.subproject }}</td>
<td class="translatetext">{{ item.source|fmttranslation }}</td>
<td class="translatetext">{{ item.target|fmttranslation:item.translation.language }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>{% trans "No other strings found." %}</p>
{% endif %}
......@@ -154,6 +154,7 @@
<ul>
<li><a href="#tab-nearby">{% trans "Nearby messages" %}</a></li>
<li><a href="/js/similar/{{ unit.id }}/">{% trans "Similar messages" %}</a></li>
<li><a href="/js/other/{{ unit.id }}/">{% trans "Other locations" %}</a></li>
<li><a href="/js/dictionary/{{ unit.id }}/">{% trans "Words in dictionary" %}</a></li>
</ul>
<div id="tab-nearby">
......
......@@ -407,6 +407,15 @@ def get_similar(request, unit_id):
'similar': similar,
}))
def get_other(request, unit_id):
unit = get_object_or_404(Unit, pk = int(unit_id))
other = Unit.objects.same(unit)
return render_to_response('other.html', RequestContext(request, {
'other': other,
}))
def get_dictionary(request, unit_id):
unit = get_object_or_404(Unit, pk = int(unit_id))
# split to words
......
......@@ -40,6 +40,7 @@ urlpatterns = patterns('',
url(r'^js/i18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
url(r'^js/config/$', 'trans.views.js_config'),
url(r'^js/similar/(?P<unit_id>[0-9]*)/$', 'trans.views.get_similar'),
url(r'^js/other/(?P<unit_id>[0-9]*)/$', 'trans.views.get_other'),
url(r'^js/dictionary/(?P<unit_id>[0-9]*)/$', 'trans.views.get_dictionary'),
# Admin interface
......
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