🐛 Fix lang alias in related posts

This commit is contained in:
xtaodada 2023-08-24 17:49:36 +08:00
parent e254241302
commit 8f34ecbb5b
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 7 additions and 1 deletions

View File

@ -109,3 +109,9 @@ class I18n:
def __getitem__(self, item):
return self.get_property(item)
@property
def lang_alias(self) -> str:
for k, v in i18n_alias.items():
if v == self.lang:
return k

View File

@ -72,7 +72,7 @@ Embed MiYouShe posts, videos, polls, and more on Telegram
{% if related_posts %}
{% for post_ in related_posts %}
<related>
{% if i18n.lang.value == 'zh-cn' %}{% set ends = '' %}{% else %}{% set ends = '/' + i18n.lang.value %}{% endif %}
{% if i18n.lang.value == 'zh-cn' %}{% set ends = '' %}{% else %}{% set ends = '/' + i18n.lang_alias %}{% endif %}
<a href="https://{{ DOMAIN }}/{{ post.url_start }}/{{ post_.post_id }}{{ ends }}">{{ post_.subject }}</a>
</related>
<br/>