Skip to content

Commit

Permalink
Translation for fluent for dataset title and description
Browse files Browse the repository at this point in the history
  • Loading branch information
blagojabozinovski committed Nov 27, 2024
1 parent b310661 commit 7f80754
Showing 1 changed file with 77 additions and 0 deletions.
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 %}

0 comments on commit 7f80754

Please sign in to comment.