Skip to content

Commit

Permalink
Internationalize i18n ckanext-archiver ckan#39
Browse files Browse the repository at this point in the history
  • Loading branch information
KrzysztofMadejski committed Mar 21, 2017
1 parent 7651399 commit 814abec
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 74 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ To translate plugin to a new language (ie. "pl") run `python setup.py init_catal

To update template file with new translation added in the code or templates
run `python setup.py extract_messages` in the root plugin directory. Then run
`./ckanext/archiver/i18n/unique_pot.sh-v` to strip other plugin's translations.
`./ckanext/archiver/i18n/unique_pot.sh -v` to strip other plugin's translations.

To update translation files for locale "pl" with new template run `python setup.py update_catalog -l pl`.

Expand Down
72 changes: 35 additions & 37 deletions ckanext/archiver/i18n/ckanext-archiver.pot
Original file line number Diff line number Diff line change
Expand Up @@ -17,96 +17,107 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.6\n"

#: ckanext/archiver/tasks.py:388 ckanext/archiver/tasks.py:409
#: ckanext/archiver/reports.py:239
#: ckanext/archiver/templates/report/broken_links.html:4
#: ckanext/archiver/templates/report/broken_links.html:15
#: ckanext/archiver/templates/report/broken_links.html:35
msgid "Broken links"
msgstr ""

#: ckanext/archiver/reports.py:240
msgid "Dataset resource URLs that are found to result in errors when resolved."
msgstr ""

#: ckanext/archiver/tasks.py:409 ckanext/archiver/tasks.py:430
#: ckanext/archiver/tasks.py:626
#, python-format
msgid "Content-length %s exceeds maximum allowed value %s"
msgstr ""

#: ckanext/archiver/tasks.py:403
#: ckanext/archiver/tasks.py:424
#, python-format
msgid "Server content contained an API error message: %s"
msgstr ""

#: ckanext/archiver/tasks.py:425
#: ckanext/archiver/tasks.py:446
#, python-format
msgid "Content-length after streaming was %i"
msgstr ""

#: ckanext/archiver/tasks.py:481
#: ckanext/archiver/tasks.py:502
msgid "No value for ckanext-archiver.cache_url_root in config"
msgstr ""

#: ckanext/archiver/tasks.py:569
#: ckanext/archiver/tasks.py:590
#, python-format
msgid "URL parsing failure: %s"
msgstr ""

#: ckanext/archiver/tasks.py:574
#: ckanext/archiver/tasks.py:595
#, python-format
msgid "Invalid url scheme. Please use one of: %s"
msgstr ""

#: ckanext/archiver/tasks.py:578
#: ckanext/archiver/tasks.py:599
msgid "URL parsing failure - did not find a host name"
msgstr ""

#: ckanext/archiver/tasks.py:605
#, python-format
msgid "Content length %s exceeds maximum allowed value %s"
msgstr ""

#: ckanext/archiver/tasks.py:701 ckanext/archiver/tasks.py:851
#: ckanext/archiver/tasks.py:722 ckanext/archiver/tasks.py:872
#, python-format
msgid "Connection error: %s"
msgstr ""

#: ckanext/archiver/tasks.py:703 ckanext/archiver/tasks.py:853
#: ckanext/archiver/tasks.py:724 ckanext/archiver/tasks.py:874
#, python-format
msgid "Invalid HTTP response: %s"
msgstr ""

#: ckanext/archiver/tasks.py:705 ckanext/archiver/tasks.py:855
#: ckanext/archiver/tasks.py:726 ckanext/archiver/tasks.py:876
#, python-format
msgid "Connection timed out after %ss"
msgstr ""

#: ckanext/archiver/tasks.py:707 ckanext/archiver/tasks.py:857
#: ckanext/archiver/tasks.py:728 ckanext/archiver/tasks.py:878
msgid "Too many redirects"
msgstr ""

#: ckanext/archiver/tasks.py:709
#: ckanext/archiver/tasks.py:730
#, python-format
msgid "Error downloading: %s"
msgstr ""

#: ckanext/archiver/tasks.py:713
#: ckanext/archiver/tasks.py:734
#, python-format
msgid "Error with the download: %s"
msgstr ""

#: ckanext/archiver/tasks.py:846
#: ckanext/archiver/tasks.py:867
msgid "Invalid URL or Redirect Link"
msgstr ""

#: ckanext/archiver/tasks.py:849
#: ckanext/archiver/tasks.py:870
msgid "Could not make HEAD request"
msgstr ""

#: ckanext/archiver/tasks.py:859
#: ckanext/archiver/tasks.py:880
#, python-format
msgid "Error during request: %s"
msgstr ""

#: ckanext/archiver/tasks.py:861
#: ckanext/archiver/tasks.py:882
#, python-format
msgid "Error with the request: %s"
msgstr ""

#: ckanext/archiver/tasks.py:868
#: ckanext/archiver/tasks.py:889
#, python-format
msgid "Server returned HTTP error status: %s %s"
msgstr ""

#: ckanext/archiver/templates/archiver/is_resource_broken.html:38
msgid "Link is broken"
msgstr ""

#: ckanext/archiver/templates/archiver/is_resource_broken.html:43
msgid "This is a one-off failure"
msgstr ""
Expand Down Expand Up @@ -163,28 +174,15 @@ msgid "No cached copy available"
msgstr ""

#: ckanext/archiver/templates/report/broken_links.html:3
#: ckanext/archiver/templates/report/broken_links.html:14
#: ckanext/archiver/templates/report/broken_links.html:34
msgid "Broken datasets"
msgstr ""

#: ckanext/archiver/templates/report/broken_links.html:4
#: ckanext/archiver/templates/report/broken_links.html:15
#: ckanext/archiver/templates/report/broken_links.html:35
msgid "Broken links"
msgstr ""

#: ckanext/archiver/templates/report/broken_links.html:14
msgid "Datasets with broken links"
msgstr ""

#: ckanext/archiver/templates/report/broken_links.html:16
msgid "% Broken links"
msgstr ""

#: ckanext/archiver/templates/report/broken_links.html:43
msgid "Publisher"
msgstr ""

#: ckanext/archiver/templates/report/broken_links.html:45
msgid "Index/position of the resource in the dataset"
msgstr ""
Expand Down
70 changes: 39 additions & 31 deletions ckanext/archiver/i18n/pl/LC_MESSAGES/ckanext-archiver.po
Original file line number Diff line number Diff line change
Expand Up @@ -18,92 +18,107 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 0.9.6\n"

#: ckanext/archiver/tasks.py:388 ckanext/archiver/tasks.py:409
#: ckanext/archiver/tasks.py:605
#: ckanext/archiver/reports.py:239
#: ckanext/archiver/templates/report/broken_links.html:4
#: ckanext/archiver/templates/report/broken_links.html:15
#: ckanext/archiver/templates/report/broken_links.html:35
msgid "Broken links"
msgstr "Błędne linki"

#: ckanext/archiver/reports.py:240
msgid "Dataset resource URLs that are found to result in errors when resolved."
msgstr "Adresy URL zewnętrznych zasobów, których nie udało się pobrać."

#: ckanext/archiver/tasks.py:409 ckanext/archiver/tasks.py:430
#: ckanext/archiver/tasks.py:626
#, python-format
msgid "Content-length %s exceeds maximum allowed value %s"
msgstr "Rozmiar zasobu %s przekracza dozwolone maksimum %s bajtów"

#: ckanext/archiver/tasks.py:403
#: ckanext/archiver/tasks.py:424
#, python-format
msgid "Server content contained an API error message: %s"
msgstr "Serwer odpowiedział błędem API: %s"

#: ckanext/archiver/tasks.py:425
#: ckanext/archiver/tasks.py:446
#, python-format
msgid "Content-length after streaming was %i"
msgstr "Rozmiar zasobu po pobraniu wyniósł %i bajtów"

#: ckanext/archiver/tasks.py:481
#: ckanext/archiver/tasks.py:502
msgid "No value for ckanext-archiver.cache_url_root in config"
msgstr "Brak w konfiguracji definicji ckanext-archiver.cache_url_root"

#: ckanext/archiver/tasks.py:569
#: ckanext/archiver/tasks.py:590
#, python-format
msgid "URL parsing failure: %s"
msgstr "Wystąpił błąd parsowania URL: %s"

#: ckanext/archiver/tasks.py:574
#: ckanext/archiver/tasks.py:595
#, python-format
msgid "Invalid url scheme. Please use one of: %s"
msgstr "Niepoprawny protokół http. Wybierz jeden z: %s"

#: ckanext/archiver/tasks.py:578
#: ckanext/archiver/tasks.py:599
msgid "URL parsing failure - did not find a host name"
msgstr "Błąd parsowania URL - nie znaleziono nazwy hosta"

#: ckanext/archiver/tasks.py:701 ckanext/archiver/tasks.py:851
#: ckanext/archiver/tasks.py:722 ckanext/archiver/tasks.py:872
#, python-format
msgid "Connection error: %s"
msgstr "Błąd połączenia: %s"

#: ckanext/archiver/tasks.py:703 ckanext/archiver/tasks.py:853
#: ckanext/archiver/tasks.py:724 ckanext/archiver/tasks.py:874
#, python-format
msgid "Invalid HTTP response: %s"
msgstr "Błędna odpowiedź HTTP: %s"

#: ckanext/archiver/tasks.py:705 ckanext/archiver/tasks.py:855
#: ckanext/archiver/tasks.py:726 ckanext/archiver/tasks.py:876
#, python-format
msgid "Connection timed out after %ss"
msgstr "Serwer nie odpowiedział po %s sekundach"

#: ckanext/archiver/tasks.py:707 ckanext/archiver/tasks.py:857
#: ckanext/archiver/tasks.py:728 ckanext/archiver/tasks.py:878
msgid "Too many redirects"
msgstr "Za dużo przekierowań"

#: ckanext/archiver/tasks.py:709
#: ckanext/archiver/tasks.py:730
#, python-format
msgid "Error downloading: %s"
msgstr "Błąd podczas pobierania: %s"

#: ckanext/archiver/tasks.py:713
#: ckanext/archiver/tasks.py:734
#, python-format
msgid "Error with the download: %s"
msgstr "Błąd podczas pobierania: %s"

#: ckanext/archiver/tasks.py:846
#: ckanext/archiver/tasks.py:867
msgid "Invalid URL or Redirect Link"
msgstr "Niepoprawny URL lub link przekierowujący"

#: ckanext/archiver/tasks.py:849
#: ckanext/archiver/tasks.py:870
msgid "Could not make HEAD request"
msgstr "Zapytanie typu HEAD nie było możliwe"

#: ckanext/archiver/tasks.py:859
#: ckanext/archiver/tasks.py:880
#, python-format
msgid "Error during request: %s"
msgstr "Wystąpił błąd podczas odpytywania serwera: %s"

#: ckanext/archiver/tasks.py:861
#: ckanext/archiver/tasks.py:882
#, python-format
msgid "Error with the request: %s"
msgstr "Wystąpił błąd podczas odpytywania serwera: %s"

#: ckanext/archiver/tasks.py:868
#: ckanext/archiver/tasks.py:889
#, python-format
msgid "Server returned HTTP error status: %s %s"
msgstr "Serwer odpowiedział błędem HTTP: %s %s"

#: ckanext/archiver/templates/archiver/is_resource_broken.html:38
msgid "Link is broken"
msgstr "Link jest błędny"

#: ckanext/archiver/templates/archiver/is_resource_broken.html:43
msgid "This is a one-off failure"
msgstr "Błąd wystąpił po raz pierwszy"
Expand All @@ -114,8 +129,8 @@ msgid ""
"This resource has failed %(failure_count)s times in a row since it first "
"failed: %(first_failure)s"
msgstr ""
"Archiwizowanie zasobu nie udało się %(failure_count)s raz z rzędu "
"od momentu %(first_failure)s"
"Archiwizowanie zasobu nie udało się %(failure_count)s raz z rzędu od "
"momentu %(first_failure)s"

#: ckanext/archiver/templates/archiver/is_resource_broken.html:48
#, python-format
Expand All @@ -127,8 +142,7 @@ msgstr "Ostatnio udało się zarchiwizować zasób %(last_success)s"
msgid ""
"We do not have a past record of it working since the first check: "
"%(created)s"
msgstr ""
"Zasób nie był dostępny od od kiedy badane są linki zewnętrzne: %(created)s"
msgstr "Zasób nie był dostępny od od kiedy badane są linki zewnętrzne: %(created)s"

#: ckanext/archiver/templates/archiver/is_resource_broken.html:53
msgid "Link check is not conclusive"
Expand Down Expand Up @@ -169,23 +183,17 @@ msgstr "Brak zarchiwizowanej kopii zasobu"
msgid "Broken datasets"
msgstr "Zbiory z błędnymi linkami"

#: ckanext/archiver/templates/report/broken_links.html:4
#: ckanext/archiver/templates/report/broken_links.html:15
#: ckanext/archiver/templates/report/broken_links.html:35
msgid "Broken links"
msgstr "Błędne linki"

#: ckanext/archiver/templates/report/broken_links.html:16
msgid "% Broken links"
msgstr "% błędnych linków"

#: ckanext/archiver/templates/report/broken_links.html:45
msgid "Index/position of the resource in the dataset"
msgstr "Pozycja zasobie w zbiorze"
msgstr "Pozycja zasobu w zbiorze"

#: ckanext/archiver/templates/report/broken_links.html:45
msgid "Res"
msgstr "Zbiór"
msgstr "Zasób"

#: ckanext/archiver/templates/report/broken_links.html:48
msgid "Reason"
Expand Down
4 changes: 3 additions & 1 deletion ckanext/archiver/reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
except ImportError:
from sqlalchemy.util import OrderedDict

from ckan.common import _
import ckan.model as model
import ckan.plugins as p

Expand Down Expand Up @@ -235,7 +236,8 @@ def broken_links_option_combinations():

broken_links_report_info = {
'name': 'broken-links',
'description': 'Dataset resource URLs that are found to result in errors when resolved.',
'title': _('Broken links'),
'description': _('Dataset resource URLs that are found to result in errors when resolved.'),
'option_defaults': OrderedDict((('organization', None),
('include_sub_organizations', False),
)),
Expand Down
2 changes: 1 addition & 1 deletion ckanext/archiver/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def _update_resource(resource_id, queue, log):

def _save(status_id, exception, resource, url_redirected_to=None,
download_result=None, archive_result=None):
reason = '%s' % exception
reason = u'%s' % exception
save_archival(resource, status_id,
reason, url_redirected_to,
download_result, archive_result,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<div class="archiver {% if is_broken %}link-broken{% elif is_broken == None %}link-not-sure{% else %}link-not-broken{% endif %}">
{%- if is_broken == True -%}
<span class="icon icon-exclamation-sign text-error"></span>
Link is broken<br>
{% trans %}Link is broken{% endtrans %}<br>
{% if reason %}
- {{ reason }}<br>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions ckanext/archiver/templates/report/broken_links.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<th class="header">{% trans %}Organization{% endtrans %}</th>
<th class="header">{% trans %}Broken datasets{% endtrans %}</th>
<th class="header">{% trans %}Broken links{% endtrans %}</th>
<th class="header">{% trans %}% Broken links{% endtrans %}</th>
<th class="header">{{ _('% Broken links') }}</th>
</tr>
</thead>
<tbody>
Expand All @@ -22,7 +22,7 @@
<td>{{ h.link_to(row['organization_title'], h.report__relative_url_for(organization=row['organization_name'])) }}</td>
<td>{{ row['broken_package_count'] }}</td>
<td>{{ row['broken_resource_count'] }}</td>
<td>{{ row.get('broken_resource_percent') }}</td>
<td>{{ row.get('broken_resource_percent') }}%</td>
</tr>
{% endfor %}
</tbody>
Expand Down

0 comments on commit 814abec

Please sign in to comment.