Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tcomment support #154

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions rosetta/templates/rosetta/pofile.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,15 @@ <h1>{% blocktrans %}Translate into {{rosetta_i18n_lang_name}}{% endblocktrans %
<input type="checkbox" name="f_{{message.md5hash}}" value="1" {% if message|is_fuzzy %}checked="checked"{% endif %} />
</td>
<td class="location">
{% for fn,lineno in message.occurrences %}
<code{% if forloop.counter|gt:"3" %} class="hide"{% endif %}>{{ fn }}:{{lineno}}</code>
{% endfor %}
{% if message.occurrences|length|gt:"3" %}
<a href="#">&hellip; ({% blocktrans count message.occurrences|length|minus:"3" as more_count %}{{more_count}} more{% plural %}{{more_count}} more{% endblocktrans %})</a>
{% if message.occurrences %}
{% for fn,lineno in message.occurrences %}
<code{% if forloop.counter|gt:"3" %} class="hide"{% endif %}>{{ fn }}:{{lineno}}</code>
{% endfor %}
{% if message.occurrences|length|gt:"3" %}
<a href="#">&hellip; ({% blocktrans count message.occurrences|length|minus:"3" as more_count %}{{more_count}} more{% plural %}{{more_count}} more{% endblocktrans %})</a>
{% endif %}
{% elif message.tcomment %}
{{ message.tcomment }}
{% endif %}
</td>
</tr>
Expand Down
24 changes: 23 additions & 1 deletion rosetta/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,29 @@ def _request_request(key, default=None):
if _request_request('query', False) and _request_request('query', '').strip():
query = _request_request('query', '').strip()
rx = re.compile(re.escape(query), re.IGNORECASE)
paginator = Paginator([e_ for e_ in rosetta_i18n_pofile if not e_.obsolete and rx.search(six.text_type(e_.msgstr) + six.text_type(e_.msgid) + u''.join([o[0] for o in e_.occurrences]))], rosetta_settings.MESSAGES_PER_PAGE)
paginator = Paginator(
[
e_
for e_
in rosetta_i18n_pofile
if (
not e_.obsolete
and rx.search(
six.text_type(e_.msgstr)
+ six.text_type(e_.msgid)
+ six.text_type(e_.tcomment)
+ u''.join(
[
o[0]
for o
in e_.occurrences
]
)
)
)
],
rosetta_settings.MESSAGES_PER_PAGE,
)
else:
if rosetta_i18n_filter == 'untranslated':
paginator = Paginator(rosetta_i18n_pofile.untranslated_entries(), rosetta_settings.MESSAGES_PER_PAGE)
Expand Down