Add localizations, layout fixes

This commit is contained in:
Mikko Nieminen 2016-11-22 14:44:38 +02:00
parent b9fe09cc8a
commit bb5152dbc4
10 changed files with 535 additions and 16 deletions

8
.tx/config Normal file
View File

@ -0,0 +1,8 @@
[main]
host = https://www.transifex.com
[sixodp.ckanext-rating]
file_filter = i18n/<lang>/LC_MESSAGES/ckanext-rating.po
source_file = i18n/ckanext-rating.pot
source_lang = en
type = PO

View File

@ -1,3 +1,15 @@
.rating {
margin: 20px 0;
}
.rating-container {
margin-bottom: 20px;
}
.rating-star {
font-size: 1.5em;
}
a.rating-star-hover,
a.rating-star-hover:hover {
color: #a38729;

View File

@ -18,17 +18,25 @@ Example:
<h1 class="heading">{{ h.dataset_display_name(pkg) }}</h1>
{% endblock %}
{% block rating %}
<p>
{% snippet "rating/stars_inactive.html", package=pkg %}
</p>
{% endblock %}
{% block user_rating %}
{{ _('Your rating') }}
<p>
{%- snippet "rating/stars.html", package=pkg -%}
{%- snippet "rating/rating_description.html", rating=h.get_user_rating(pkg.id) -%}
</p>
<div class="rating">
{% block general_rating %}
{{ _('Rating') }}
<div class="rating-container">
{% snippet "rating/stars_inactive.html", package=pkg %}
</div>
{% endblock %}
{% block user_rating %}
{{ _('Your rating') }}
<div class="rating-container">
{%- snippet "rating/stars.html", package=pkg -%}
<span class="rating-details">
{%- snippet "rating/rating_description.html", rating=h.get_user_rating(pkg.id) -%}
</span>
</div>
{% endblock %}
</div>
{% endblock %}
{% block nums %}
<div class="nums">
<dl>

View File

@ -15,10 +15,10 @@ package - The package for which the rating belongs to
<span class="star-rating{% if stars == 0 %} no-stars{% endif %}">
<span class="star-rating-stars">
{%- for index in range(stars|int) -%}
<a class="icon icon-star icon-2x rating-star" id="star-{{index}}" href="/rating/{{ package.type }}/{{ package.name }}/{{ index + 1 }}"></a>
<a class="icon icon-star rating-star" id="star-{{index}}" href="/rating/{{ package.type }}/{{ package.name }}/{{ index + 1 }}"></a>
{%- endfor -%}
{%- for index in range(stars|int, 5) -%}
<a class="icon icon-star-empty icon-2x rating-star" href="/rating/{{ package.type }}/{{ package.name }}/{{ index + 1 }}"></a>
<a class="icon icon-star-empty rating-star" href="/rating/{{ package.type }}/{{ package.name }}/{{ index + 1 }}"></a>
{%- endfor -%}
</span>
</span>

View File

@ -12,11 +12,13 @@ stars - The number of stars to be displayed.
<span class="star-rating{% if stars == 0 %} no-stars{% endif %}">
<span class="star-rating-stars">
{%- for index in range(stars|int) -%}
<span class="icon icon-star icon-2x rating-star"></span>
<span class="icon icon-star rating-star"></span>
{%- endfor -%}
{%- for index in range(stars|int, 5) -%}
<span class="icon icon-star-empty icon-2x rating-star"></span>
<span class="icon icon-star-empty rating-star"></span>
{%- endfor -%}
</span>
</span>
{{ ratings_count }} {{ _('rating') if ratings_count == 1 else _('ratings') }}
<span class="rating-description">
{{ ratings_count }} {{ _('rating') if ratings_count == 1 else _('ratings') }}
</span>

120
i18n/ckanext-rating.pot Normal file
View File

@ -0,0 +1,120 @@
# Translations template for ckanext-rating.
# Copyright (C) 2016 ORGANIZATION
# This file is distributed under the same license as the ckanext-rating project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2016.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ckanext-rating 0.0.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-11-22 11:39+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
#: ckanext/rating/logic/action.py:29
msgid "You must supply a package id or name (parameter \"package\")."
msgstr ""
#: ckanext/rating/logic/action.py:32
msgid "You must supply a rating (parameter \"rating\")."
msgstr ""
#: ckanext/rating/logic/action.py:37
msgid "Rating must be an integer value."
msgstr ""
#: ckanext/rating/logic/action.py:41
#, python-format
msgid "Rating must be between %i and %i."
msgstr ""
#: ckanext/rating/logic/action.py:44
msgid "Not found"
msgstr ""
#: ckanext/rating/logic/action.py:59
msgid "You must supply a package id (parameter \"package_id\")."
msgstr ""
#: ckanext/rating/templates/package/snippets/info.html:26
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:17
msgid "Your rating"
msgstr ""
#: ckanext/rating/templates/package/snippets/info.html:35
msgid "Followers"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:10
msgid "no rating given"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:12
msgid "bad"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:14
msgid "passable"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:16
msgid "ok"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:18
msgid "good"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:20
msgid "excellent"
msgstr ""
#: ckanext/rating/templates/rating/stars_inactive.html:22
msgid "rating"
msgstr ""
#: ckanext/rating/templates/rating/stars_inactive.html:22
msgid "ratings"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:8
msgid "Submitted by"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:26
msgid "Launch website"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:19
msgid "This showcase has no description"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:24
msgid "{num} Dataset"
msgid_plural "{num} Datasets"
msgstr[0] ""
msgstr[1] ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:26
msgid "0 Datasets"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:30
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:31
msgid "View {showcase_title}"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:35
msgid "Remove"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:35
msgid "Remove dataset from this showcase"
msgstr ""

View File

@ -0,0 +1,120 @@
# Translations template for ckanext-rating.
# Copyright (C) 2016 ORGANIZATION
# This file is distributed under the same license as the ckanext-rating project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2016.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ckanext-rating 0.0.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-11-22 11:39+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Language-Team: English (United Kingdom) (https://www.transifex.com/6aika-dataportal/teams/68018/en_GB/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
"Language: en_GB\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ckanext/rating/logic/action.py:29
msgid "You must supply a package id or name (parameter \"package\")."
msgstr ""
#: ckanext/rating/logic/action.py:32
msgid "You must supply a rating (parameter \"rating\")."
msgstr ""
#: ckanext/rating/logic/action.py:37
msgid "Rating must be an integer value."
msgstr ""
#: ckanext/rating/logic/action.py:41
#, python-format
msgid "Rating must be between %i and %i."
msgstr ""
#: ckanext/rating/logic/action.py:44
msgid "Not found"
msgstr ""
#: ckanext/rating/logic/action.py:59
msgid "You must supply a package id (parameter \"package_id\")."
msgstr ""
#: ckanext/rating/templates/package/snippets/info.html:26
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:17
msgid "Your rating"
msgstr ""
#: ckanext/rating/templates/package/snippets/info.html:35
msgid "Followers"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:10
msgid "no rating given"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:12
msgid "bad"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:14
msgid "passable"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:16
msgid "ok"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:18
msgid "good"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:20
msgid "excellent"
msgstr ""
#: ckanext/rating/templates/rating/stars_inactive.html:22
msgid "rating"
msgstr ""
#: ckanext/rating/templates/rating/stars_inactive.html:22
msgid "ratings"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:8
msgid "Submitted by"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:26
msgid "Launch website"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:19
msgid "This showcase has no description"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:24
msgid "{num} Dataset"
msgid_plural "{num} Datasets"
msgstr[0] ""
msgstr[1] ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:26
msgid "0 Datasets"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:30
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:31
msgid "View {showcase_title}"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:35
msgid "Remove"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:35
msgid "Remove dataset from this showcase"
msgstr ""

View File

@ -0,0 +1,121 @@
# Translations template for ckanext-rating.
# Copyright (C) 2016 ORGANIZATION
# This file is distributed under the same license as the ckanext-rating project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2016.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ckanext-rating 0.0.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-11-22 11:39+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Mikko Nieminen <mikko.nieminen@gofore.com>, 2016\n"
"Language-Team: Finnish (https://www.transifex.com/6aika-dataportal/teams/68018/fi/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
"Language: fi\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ckanext/rating/logic/action.py:29
msgid "You must supply a package id or name (parameter \"package\")."
msgstr ""
#: ckanext/rating/logic/action.py:32
msgid "You must supply a rating (parameter \"rating\")."
msgstr ""
#: ckanext/rating/logic/action.py:37
msgid "Rating must be an integer value."
msgstr ""
#: ckanext/rating/logic/action.py:41
#, python-format
msgid "Rating must be between %i and %i."
msgstr ""
#: ckanext/rating/logic/action.py:44
msgid "Not found"
msgstr ""
#: ckanext/rating/logic/action.py:59
msgid "You must supply a package id (parameter \"package_id\")."
msgstr ""
#: ckanext/rating/templates/package/snippets/info.html:26
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:17
msgid "Your rating"
msgstr "Antamasi arvosana"
#: ckanext/rating/templates/package/snippets/info.html:35
msgid "Followers"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:10
msgid "no rating given"
msgstr "arvostelua ei annettu"
#: ckanext/rating/templates/rating/rating_description.html:12
msgid "bad"
msgstr "huono"
#: ckanext/rating/templates/rating/rating_description.html:14
msgid "passable"
msgstr "välttävä"
#: ckanext/rating/templates/rating/rating_description.html:16
msgid "ok"
msgstr "ok"
#: ckanext/rating/templates/rating/rating_description.html:18
msgid "good"
msgstr "hyvä"
#: ckanext/rating/templates/rating/rating_description.html:20
msgid "excellent"
msgstr "loistava"
#: ckanext/rating/templates/rating/stars_inactive.html:22
msgid "rating"
msgstr "arvostelu"
#: ckanext/rating/templates/rating/stars_inactive.html:22
msgid "ratings"
msgstr "arvostelua"
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:8
msgid "Submitted by"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:26
msgid "Launch website"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:19
msgid "This showcase has no description"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:24
msgid "{num} Dataset"
msgid_plural "{num} Datasets"
msgstr[0] ""
msgstr[1] ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:26
msgid "0 Datasets"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:30
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:31
msgid "View {showcase_title}"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:35
msgid "Remove"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:35
msgid "Remove dataset from this showcase"
msgstr ""

View File

@ -0,0 +1,120 @@
# Translations template for ckanext-rating.
# Copyright (C) 2016 ORGANIZATION
# This file is distributed under the same license as the ckanext-rating project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2016.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: ckanext-rating 0.0.1\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2016-11-22 11:39+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Language-Team: Swedish (https://www.transifex.com/6aika-dataportal/teams/68018/sv/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.3.4\n"
"Language: sv\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ckanext/rating/logic/action.py:29
msgid "You must supply a package id or name (parameter \"package\")."
msgstr ""
#: ckanext/rating/logic/action.py:32
msgid "You must supply a rating (parameter \"rating\")."
msgstr ""
#: ckanext/rating/logic/action.py:37
msgid "Rating must be an integer value."
msgstr ""
#: ckanext/rating/logic/action.py:41
#, python-format
msgid "Rating must be between %i and %i."
msgstr ""
#: ckanext/rating/logic/action.py:44
msgid "Not found"
msgstr ""
#: ckanext/rating/logic/action.py:59
msgid "You must supply a package id (parameter \"package_id\")."
msgstr ""
#: ckanext/rating/templates/package/snippets/info.html:26
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:17
msgid "Your rating"
msgstr ""
#: ckanext/rating/templates/package/snippets/info.html:35
msgid "Followers"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:10
msgid "no rating given"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:12
msgid "bad"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:14
msgid "passable"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:16
msgid "ok"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:18
msgid "good"
msgstr ""
#: ckanext/rating/templates/rating/rating_description.html:20
msgid "excellent"
msgstr ""
#: ckanext/rating/templates/rating/stars_inactive.html:22
msgid "rating"
msgstr ""
#: ckanext/rating/templates/rating/stars_inactive.html:22
msgid "ratings"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:8
msgid "Submitted by"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_info.html:26
msgid "Launch website"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:19
msgid "This showcase has no description"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:24
msgid "{num} Dataset"
msgid_plural "{num} Datasets"
msgstr[0] ""
msgstr[1] ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:26
msgid "0 Datasets"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:30
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:31
msgid "View {showcase_title}"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:35
msgid "Remove"
msgstr ""
#: ckanext/rating/templates/showcase/snippets/showcase_item.html:35
msgid "Remove dataset from this showcase"
msgstr ""

View File

@ -83,5 +83,13 @@ setup(
[paste.paster_command]
rating=ckanext.rating.commands:RatingCommand
'''
''',
message_extractors={
'ckanext': [
('**.py', 'python', None),
('**.js', 'javascript', None),
('**/templates/**.html', 'ckan', None),
],
}
)