]> danix's work - danix.xyz-2.git/commitdiff
Revert "fix: detect language server-side in 404 template for proper translations"
authorDanilo M. <redacted>
Fri, 17 Apr 2026 09:57:11 +0000 (11:57 +0200)
committerDanilo M. <redacted>
Fri, 17 Apr 2026 09:57:11 +0000 (11:57 +0200)
This reverts commit b25385f7313edce6191a038dc906d88d6b26c7a3.

themes/danix-xyz-hacker/layouts/404.html

index 9b50b44ed6b69f723591d13bb1781eaa4655622d..341f90b16e75e550b2e32d36d79b6ad961f6955c 100644 (file)
@@ -1,40 +1,5 @@
 {{ define "main" }}
 
-{{ $lang := "en" }}
-{{ if in .Permalink "/it/" }}
-  {{ $lang = "it" }}
-{{ end }}
-
-{{ $translations := dict "en" (dict
-  "notFound" "Page Not Found"
-  "notFoundMessage" "Sorry, the page you're looking for doesn't exist. Try searching or browse the articles below."
-  "searchPlaceholder" "Search articles..."
-  "noSearchResults" "No articles found matching your search."
-  "recentArticles" "Recent Articles"
-  "goHome" "Go Home"
-  "browseArticles" "Browse Articles"
-  "contactSupport" "Get in Touch"
-  "followWhiteRabbit" "Follow the white rabbit..."
-  "easterEggTitle" "Choose Your Path"
-  "bluePill" "Stay Here"
-  "redPill" "Show Me More"
-) "it" (dict
-  "notFound" "Pagina Non Trovata"
-  "notFoundMessage" "Mi dispiace, la pagina che stai cercando non esiste. Prova a cercare o sfoglia gli articoli qui sotto."
-  "searchPlaceholder" "Cerca articoli..."
-  "noSearchResults" "Nessun articolo trovato che corrisponda alla tua ricerca."
-  "recentArticles" "Articoli Recenti"
-  "goHome" "Torna a Casa"
-  "browseArticles" "Sfoglia Articoli"
-  "contactSupport" "Contattami"
-  "followWhiteRabbit" "Segui il coniglio bianco..."
-  "easterEggTitle" "Scegli il Tuo Percorso"
-  "bluePill" "Rimani Qui"
-  "redPill" "Mostrami di PiΓΉ"
-) }}
-
-{{ $t := index $translations $lang }}
-
 <!-- Detect language from current URL -->
 <script>
 window.currentLang = window.location.pathname.startsWith('/it/') ? 'it' : 'en';
@@ -64,21 +29,21 @@ window.articlesData = [
 
     <!-- Error Message -->
     <h2 class="text-3xl md:text-4xl font-bold mb-6">
-      {{ index $t "notFound" }}
+      {{ i18n "notFound" }}
     </h2>
 
     <p class="text-lg text-text-dim mb-8">
-      {{ index $t "notFoundMessage" }}
+      {{ i18n "notFoundMessage" }}
     </p>
 
     <!-- Search Box -->
     <div class="mb-12">
       <form id="search-form" class="flex flex-col gap-4">
-        <label for="search-input" class="sr-only">{{ index $t "searchPlaceholder" }}</label>
+        <label for="search-input" class="sr-only">{{ i18n "searchPlaceholder" }}</label>
         <input
           id="search-input"
           type="text"
-          placeholder="{{ index $t "searchPlaceholder" }}"
+          placeholder="{{ (i18n "searchPlaceholder") }}"
           class="px-4 py-3 border-2 border-border rounded focus:outline-none focus:ring-2 focus:ring-accent focus:border-transparent bg-bg text-text"
           @input="filterArticles($el.value)"
         />
@@ -94,13 +59,13 @@ window.articlesData = [
         </template>
       </div>
       <div x-show="searchQuery && filteredArticles.length === 0" class="mt-4 text-text-dim">
-        {{ index $t "noSearchResults" }}
+        {{ i18n "noSearchResults" }}
       </div>
     </div>
 
     <!-- Recent Articles Section -->
     <div class="mb-12">
-      <h3 class="text-2xl font-bold mb-6">{{ index $t "recentArticles" }}</h3>
+      <h3 class="text-2xl font-bold mb-6">{{ i18n "recentArticles" }}</h3>
       <div class="space-y-4">
         {{ range first 5 (where .Site.RegularPages "Section" "articles") }}
         <div class="p-4 border-l-4 border-accent bg-bg/50 hover:bg-bg/70 transition-colors">
@@ -118,13 +83,13 @@ window.articlesData = [
     <!-- Navigation Links -->
     <div class="space-y-4 flex flex-col items-center mb-12" x-data="notFoundNav()">
       <a :href="homeLink" @click.prevent="goHome()" class="btn btn-primary">
-        {{ index $t "goHome" }}
+        {{ i18n "goHome" }}
       </a>
       <a :href="articlesLink" @click.prevent="goArticles()" class="btn btn-secondary">
-        {{ index $t "browseArticles" }}
+        {{ i18n "browseArticles" }}
       </a>
       <a :href="contactLink" @click.prevent="goContact()" class="btn btn-outline">
-        {{ index $t "contactSupport" }}
+        {{ i18n "contactSupport" }}
       </a>
     </div>
 
@@ -135,7 +100,7 @@ window.articlesData = [
         @click="toggleEasterEgg()"
         class="text-sm text-text-dim hover:text-accent transition-colors underline"
       >
-        {{ index $t "followWhiteRabbit" }}
+        {{ i18n "followWhiteRabbit" }}
       </button>
     </div>
 
@@ -154,7 +119,7 @@ window.articlesData = [
 
         <!-- Modal Content -->
         <div class="relative bg-bg border-2 border-accent p-8 rounded-lg shadow-xl max-w-md mx-4">
-          <h2 class="text-2xl font-bold mb-6 text-accent">{{ index $t "easterEggTitle" }}</h2>
+          <h2 class="text-2xl font-bold mb-6 text-accent">{{ i18n "easterEggTitle" }}</h2>
 
           <div class="space-y-4">
             <button
@@ -162,7 +127,7 @@ window.articlesData = [
               @click="showEasterEgg = false; window.location.href = '{{ .Site.BaseURL }}'"
               class="w-full btn btn-primary"
             >
-              πŸ’Š {{ index $t "bluePill" }}
+              πŸ’Š {{ i18n "bluePill" }}
             </button>
 
             <button
@@ -170,7 +135,7 @@ window.articlesData = [
               @click="goToRandomArticle()"
               class="w-full btn btn-secondary"
             >
-              πŸ° {{ index $t "redPill" }}
+              πŸ° {{ i18n "redPill" }}
             </button>
           </div>