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

Translation for fluent for dataset title and description #50

Merged
merged 1 commit into from
Nov 27, 2024
Merged
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
77 changes: 77 additions & 0 deletions ckanext/alisea/templates/snippets/package_item.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{#
Displays a single of dataset.

package - A package to display.
item_class - The class name to use on the list item.
hide_resources - If true hides the resources (default: false).

Example:

{% snippet 'snippets/package_item.html', package=c.datasets[0] %}

#}

{% set current_lang = request.environ.CKAN_LANG %}
{% if current_lang == 'en' %}
{% set title = package.title or package.name %}
{% set notes = h.markdown_extract(package.notes, extract_length=180) %}
{% else %}
{% set title = package.title_translated[current_lang] or package.name %}
{% set notes = h.markdown_extract(package.notes_translated[current_lang], extract_length=180) %}
{% endif %}

{% block package_item %}
<li class="{{ item_class or "dataset-item" }}">
{% block content %}
<div class="dataset-content">
{% block heading %}
<h2 class="dataset-heading">
{% block heading_private %}
{% if package.private %}
<span class="dataset-private badge bg-secondary">
<i class="fa fa-lock"></i>
{{ _('Private') }}
</span>
{% endif %}
{% endblock %}
{% block heading_title %}
<a href="{{ h.url_for('%s.read' % package.type, id=package.name) }}" title="{{ title }}">
{{title|truncate(80)}}
</a>
{% endblock %}
{% block heading_meta %}
{% if package.get('state', '').startswith('draft') %}
<span class="badge bg-info">{{ _('Draft') }}</span>
{% elif package.get('state', '').startswith('deleted') %}
<span class="badge bg-danger">{{ _('Deleted') }}</span>
{% endif %}
{{ h.popular('recent views', package.tracking_summary.recent, min=10) if package.tracking_summary }}
{% endblock %}
</h2>
{% endblock %}
{% block notes %}
{% if notes %}
<div>{{ notes|urlize }}</div>
{% else %}
<p class="empty">{{ h.humanize_entity_type('package', package.type, 'no description') or _("There is no description for this dataset") }}</p>
{% endif %}
{% endblock %}
</div>
{% block resources %}
{% if package.resources and not hide_resources %}
{% block resources_outer %}
<ul class="dataset-resources list-unstyled">
{% block resources_inner %}
{% for resource in h.dict_list_reduce(package.resources, 'format') %}
<li>
<a href="{{ h.url_for(package.type ~ '.read', id=package.name) }}" class="badge badge-default" data-format="{{ resource.lower() }}">{{ resource }}</a>
</li>
{% endfor %}
{% endblock %}
</ul>
{% endblock %}
{% endif %}
{% endblock %}
{% endblock %}
</li>
{% endblock %}