Refactor translations and update blog and Anti-Fingerprinting Shield Plus pages

- Removed unused translation sections for blog and Anti-Fingerprinting Shield Plus to streamline the codebase.
- Updated blog page to utilize dynamic translations based on the selected language.
- Enhanced Anti-Fingerprinting Shield Plus page to fetch translations correctly, improving maintainability and user experience.
This commit is contained in:
becarta
2025-05-14 00:38:25 +02:00
parent 71c674392b
commit b5fbfec352
4 changed files with 29 additions and 582 deletions

View File

@@ -12,6 +12,7 @@ import { getStaticPathsBlogPost, blogPostRobots } from '~/utils/blog';
import { findImage } from '~/utils/images';
import type { MetaData } from '~/types';
import RelatedPosts from '~/components/blog/RelatedPosts.astro';
import { getBlogTranslation, supportedLanguages } from '~/i18n/translations.blog';
export const prerender = true;
@@ -23,13 +24,17 @@ type Props = InferGetStaticPropsType<typeof getStaticPaths>;
const { post } = Astro.props as Props;
// Try to extract lang from post or fallback to 'en'
const lang = post?.lang && supportedLanguages.includes(post.lang) ? post.lang : 'en';
const blogT = getBlogTranslation(lang);
const url = getCanonical(getPermalink(post.permalink, 'post'));
const image = (await findImage(post.image)) as ImageMetadata | string | undefined;
const metadata = merge(
{
title: post.title,
description: post.excerpt,
title: blogT.title,
description: blogT.information,
robots: {
index: blogPostRobots?.index,
follow: blogPostRobots?.follow,

View File

@@ -2,7 +2,7 @@
export const prerender = true;
import Layout from '~/layouts/PageLayout.astro';
import { getTranslation, supportedLanguages } from '~/i18n/translations';
import { getAntifpTranslation, supportedLanguages } from '~/i18n/translations.antifp';
export async function getStaticPaths() {
return supportedLanguages.map((lang) => ({
@@ -15,22 +15,22 @@ if (!supportedLanguages.includes(lang)) {
return Astro.redirect('/en/antifp');
}
const t = getTranslation(lang);
const t = getAntifpTranslation(lang);
const metadata = {
title: t.antifp.title,
description: t.antifp.description,
title: t.title,
description: t.description,
};
---
<Layout metadata={metadata}>
<div class="max-w-3xl mx-auto px-4 py-8">
<h1 class="text-3xl font-bold mb-4">{t.antifp.title}</h1>
<h1 class="text-3xl font-bold mb-4">{t.title}</h1>
<p class="mb-4">
<a href="https://greasyfork.org/en/scripts/534570-anti-fingerprinting-shield-plus" target="_blank" rel="noopener noreferrer" class="text-blue-600 underline">{t.antifp.viewOnGreasyFork}</a>
<a href="https://greasyfork.org/en/scripts/534570-anti-fingerprinting-shield-plus" target="_blank" rel="noopener noreferrer" class="text-blue-600 underline">{t.viewOnGreasyFork}</a>
</p>
<p class="mb-6 text-lg">
{t.antifp.summary}
{t.summary}
</p>
<figure class="mb-8">
@@ -38,29 +38,29 @@ const metadata = {
<figcaption class="text-center text-gray-500 text-sm mt-2">This screenshot shows the settings panel for Anti-Fingerprinting Shield Plus, where all fingerprinting protection options are enabled.</figcaption>
</figure>
<h2 class="text-2xl font-semibold mb-4">{t.antifp.features.title}</h2>
<h2 class="text-2xl font-semibold mb-4">{t.features.title}</h2>
<ul class="list-disc list-inside mb-8 space-y-2">
{t.antifp.features.items.map((item) => (
{t.features.items.map((item) => (
<li class="text-gray-700">{item}</li>
))}
</ul>
<h2 class="text-2xl font-semibold mb-4">{t.antifp.howToInstall}</h2>
<h2 class="text-2xl font-semibold mb-4">{t.howToInstall}</h2>
<ol class="list-decimal list-inside mb-8 space-y-2">
<li>{t.antifp.step1}</li>
<li>{t.antifp.step2}</li>
<li>{t.antifp.step3}</li>
<li>{t.antifp.step4}</li>
<li>{t.step1}</li>
<li>{t.step2}</li>
<li>{t.step3}</li>
<li>{t.step4}</li>
</ol>
<h2 class="text-2xl font-semibold mb-4">{t.antifp.notes.title}</h2>
<h2 class="text-2xl font-semibold mb-4">{t.notes.title}</h2>
<ul class="list-disc list-inside mb-8 space-y-2">
{t.antifp.notes.items.map((item) => (
{t.notes.items.map((item) => (
<li class="text-gray-700">{item}</li>
))}
</ul>
<p class="text-gray-600 italic">{t.antifp.targetAudience}</p>
<p class="mt-4 text-gray-600">{t.antifp.moreDetails}</p>
<p class="text-gray-600 italic">{t.targetAudience}</p>
<p class="mt-4 text-gray-600">{t.moreDetails}</p>
</div>
</Layout>

View File

@@ -2,7 +2,7 @@
export const prerender = true;
import Layout from '~/layouts/PageLayout.astro';
import { getTranslation, supportedLanguages } from '~/i18n/translations';
import { getEapTranslation, supportedLanguages } from '~/i18n/translations.eap';
export async function getStaticPaths() {
return supportedLanguages.map((lang) => ({
@@ -15,8 +15,7 @@ if (!supportedLanguages.includes(lang)) {
return Astro.redirect('/en/eap');
}
const t = getTranslation(lang);
const eap = t.eap;
const eap = getEapTranslation(lang);
const metadata = {
title: eap.title,