alexohneander-zola/static/feed_style.xsl
Óscar 32a2d5094b
🌐 feat(i18n): overhaul translation system & add languages (#145)
Revamp the existing translation system, simplifying
management and adding several new languages. The new system reads from
TOML files in the `/i18n` directory and improves template structures.
It also enhances customisation options and robustness by providing
fallbacks and modularity.

- Implement a new, streamlined translation macro.
- Load translations from `/i18n` TOML files.
- Remove redundant configuration requirements.
- Refactor templates to align with new i18n system.
- Add support for Hindi, Japanese, Russian, Portuguese, Chinese,
  Italian, German, Ukranian, Korean, and French languages.
- Credit Thomas Weitzel (@thomasweitzel) for inspiration.
2023-09-12 18:58:58 +02:00

84 lines
3.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:atom="http://www.w3.org/2005/Atom" xmlns:base="http://purl.org/atompub/base/1.0/" xmlns:str="https://github.com/welpo/tabi">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>
<xsl:value-of select="/atom:feed/atom:title"/> • Feed
</title>
<meta charset="utf-8"/>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<link rel="stylesheet" href="{/atom:feed/@xml:base}/main.css"/>
<link rel="stylesheet" href="{/atom:feed/atom:link[@rel='extra-stylesheet']/@href}" />
</head>
<body>
<div class="content">
<main>
<div class="info-box">
<!-- This block replaces the text "About Feeds" with a hyperlink in the translated string -->
<xsl:choose>
<xsl:when test="contains(/atom:feed/str:translations/str:about_feeds, 'About Feeds')">
<xsl:value-of select="substring-before(/atom:feed/str:translations/str:about_feeds, 'About Feeds')"/>
<a href="https://aboutfeeds.com/" target="_blank">About Feeds</a>
<xsl:value-of select="substring-after(/atom:feed/str:translations/str:about_feeds, 'About Feeds')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="/atom:feed/str:translations/str:about_feeds"/>
</xsl:otherwise>
</xsl:choose>
</div>
<section id="banner-home-subtitle">
<div class="padding-top home-title">
<xsl:value-of select="/atom:feed/atom:title"/>
</div>
<p>
<xsl:value-of select="/atom:feed/atom:subtitle"/>
</p>
<a class="readmore">
<xsl:attribute name="href">
<xsl:value-of select="/atom:feed/atom:link[2]/@href"/>
</xsl:attribute>
<xsl:value-of select="/atom:feed/str:translations/str:visit_the_site" /></a><p></p>
</section>
<div class="padding-top listing-title bottom-divider">
<h1><xsl:value-of select="/atom:feed/str:translations/str:recent_posts" /></h1>
</div>
<div class="bloglist-container">
<xsl:for-each select="/atom:feed/atom:entry">
<section class="bloglist-row bottom-divider">
<div class="date">
<xsl:value-of select="substring(atom:published, 0, 11)"/>
</div>
<div class="bloglist-content">
<div class="bloglist-title">
<a>
<xsl:attribute name="href">
<xsl:value-of select="atom:link/@href"/>
</xsl:attribute>
<xsl:value-of select="atom:title"/>
</a>
</div>
<div class="description">
<xsl:value-of select="atom:summary"/>
</div>
<a class="readmore" href="">
<xsl:attribute name="href">
<xsl:value-of select="atom:link/@href"/>
</xsl:attribute>
</a>
</div>
</section>
</xsl:for-each>
</div>
</main>
</div>
</body>
</html>
</xsl:template>
</xsl:stylesheet>