mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 22:12:24 +01:00
Use package translation on tiles
This commit is contained in:
parent
9173d3c578
commit
1b5791a358
@ -494,7 +494,7 @@ class Package(db.Model):
|
|||||||
def get_id(self):
|
def get_id(self):
|
||||||
return "{}/{}".format(self.author.username, self.name)
|
return "{}/{}".format(self.author.username, self.name)
|
||||||
|
|
||||||
def get_translated(self, lang=None):
|
def get_translated(self, lang=None, load_desc=True):
|
||||||
if lang is None:
|
if lang is None:
|
||||||
locale = get_locale()
|
locale = get_locale()
|
||||||
if locale:
|
if locale:
|
||||||
@ -510,13 +510,13 @@ class Package(db.Model):
|
|||||||
return {
|
return {
|
||||||
"title": self.title,
|
"title": self.title,
|
||||||
"short_desc": self.short_desc,
|
"short_desc": self.short_desc,
|
||||||
"desc": self.desc,
|
"desc": self.desc if load_desc else None,
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"title": translation.title or self.title,
|
"title": translation.title or self.title,
|
||||||
"short_desc": translation.short_desc or self.short_desc,
|
"short_desc": translation.short_desc or self.short_desc,
|
||||||
"desc": translation.desc or self.desc,
|
"desc": (translation.desc or self.desc) if load_desc else None,
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_sorted_dependencies(self, is_hard=None):
|
def get_sorted_dependencies(self, is_hard=None):
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
{% macro render_pkgtile(package, show_author) -%}
|
{% macro render_pkgtile(package, show_author) -%}
|
||||||
|
{% set meta = package.get_translated(load_desc=False) %}
|
||||||
<li class="packagetile flex-fill"><a href="{{ package.get_url('packages.view') }}">
|
<li class="packagetile flex-fill"><a href="{{ package.get_url('packages.view') }}">
|
||||||
<img src="{{ package.get_thumb_or_placeholder() }}" loading="lazy">
|
<img src="{{ package.get_thumb_or_placeholder() }}" loading="lazy">
|
||||||
<div class="packagegridscrub"></div>
|
<div class="packagegridscrub"></div>
|
||||||
<div class="packagegridinfo">
|
<div class="packagegridinfo">
|
||||||
<h3>
|
<h3>
|
||||||
{{ package.title }}
|
{{ meta.title }}
|
||||||
|
|
||||||
{% if show_author %}<br />
|
{% if show_author %}<br />
|
||||||
<small>{{ package.author.display_name }}</small>
|
<small>{{ package.author.display_name }}</small>
|
||||||
@ -17,7 +18,7 @@
|
|||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
{{ package.short_desc }}
|
{{ meta.short_desc }}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{% if not package.license.is_foss and not package.media_license.is_foss and package.type != package.type.TXP %}
|
{% if not package.license.is_foss and not package.media_license.is_foss and package.type != package.type.TXP %}
|
||||||
|
Loading…
Reference in New Issue
Block a user