mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-19 19:04:06 -06:00
Localization
This commit is contained in:
parent
c0a6fa35ac
commit
9309a0f925
@ -15,7 +15,7 @@ const config: QuartzConfig = {
|
||||
analytics: {
|
||||
provider: "plausible",
|
||||
},
|
||||
locale: "en-US",
|
||||
locale: "fi-FI",
|
||||
baseUrl: "quartz.jzhao.xyz",
|
||||
ignorePatterns: ["private", "templates", ".obsidian"],
|
||||
defaultDateType: "modified",
|
||||
|
||||
@ -239,6 +239,7 @@ async function decryptWithPassword(
|
||||
const errorDiv = container.querySelector(".decrypt-error") as HTMLElement
|
||||
const encryptedData = (container as HTMLElement).dataset.encrypted!
|
||||
const config = JSON.parse((container as HTMLElement).dataset.config!)
|
||||
const i18n = JSON.parse((container as HTMLElement).dataset.i18n!)
|
||||
|
||||
if (showError) errorDiv.style.display = "none"
|
||||
|
||||
@ -249,7 +250,7 @@ async function decryptWithPassword(
|
||||
const isValidPassword = await verifyPassword(password, parsed)
|
||||
|
||||
if (!isValidPassword) {
|
||||
if (showError) throw new Error("Incorrect password")
|
||||
if (showError) throw new Error(i18n.incorrectPassword)
|
||||
return false
|
||||
}
|
||||
|
||||
@ -277,11 +278,11 @@ async function decryptWithPassword(
|
||||
return true
|
||||
}
|
||||
|
||||
if (showError) throw new Error("Decryption failed, check logs")
|
||||
if (showError) throw new Error(i18n.decryptionFailed)
|
||||
return false
|
||||
} catch (decryptError) {
|
||||
if (showError) showLoading(container, false)
|
||||
if (showError) throw new Error("Decryption failed, check logs")
|
||||
if (showError) throw new Error(i18n.decryptionFailed)
|
||||
return false
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
@ -64,6 +64,16 @@ export default {
|
||||
? `دقيقتان للقراءة`
|
||||
: `${minutes} دقائق للقراءة`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ محتوى محدود 🛡️",
|
||||
restricted: "هذا المحتوى محدود. ادخل كلمة المرور للعرض:",
|
||||
enterPassword: "ادخل كلمة المرور",
|
||||
decrypt: "فك التشفير",
|
||||
decrypting: "جاري فك التشفير...",
|
||||
incorrectPassword: "كلمة مرور خاطئة. حاول مرة أخرى.",
|
||||
decryptionFailed: "فشل فك التشفير، تحقق من السجلات",
|
||||
encryptedDescription: "هذا الملف مشفر. افتحه لرؤية المحتويات.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `Es llegeix en ${minutes} min`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Contingut Restringit 🛡️",
|
||||
restricted: "Aquest contingut està restringit. Introduïu la contrasenya per veure:",
|
||||
enterPassword: "Introduïu la contrasenya",
|
||||
decrypt: "Desxifrar",
|
||||
decrypting: "Desxifrant...",
|
||||
incorrectPassword: "Contrasenya incorrecta. Torneu-ho a intentar.",
|
||||
decryptionFailed: "Ha fallat el desxifratge, comproveu els registres",
|
||||
encryptedDescription: "Aquest fitxer està xifrat. Obriu-lo per veure els continguts.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} min čtení`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Omezený obsah 🛡️",
|
||||
restricted: "Tento obsah je omezen. Zadejte heslo pro zobrazení:",
|
||||
enterPassword: "Zadejte heslo",
|
||||
decrypt: "Dešifrovat",
|
||||
decrypting: "Dešifruji...",
|
||||
incorrectPassword: "Nesprávné heslo. Zkuste to znovu.",
|
||||
decryptionFailed: "Dešifrování selhalo, zkontrolujte protokoly",
|
||||
encryptedDescription: "Tento soubor je zašifrován. Otevřete jej pro zobrazení obsahu.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} min read`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Eingeschränkter Inhalt 🛡️",
|
||||
restricted: "Dieser Inhalt ist eingeschränkt. Geben Sie das Passwort ein, um ihn anzuzeigen:",
|
||||
enterPassword: "Passwort eingeben",
|
||||
decrypt: "Entschlüsseln",
|
||||
decrypting: "Entschlüsselt...",
|
||||
incorrectPassword: "Falsches Passwort. Bitte versuchen Sie es erneut.",
|
||||
decryptionFailed: "Entschlüsselung fehlgeschlagen, überprüfen Sie die Protokolle",
|
||||
encryptedDescription: "Diese Datei ist verschlüsselt. Öffnen Sie sie, um den Inhalt zu sehen.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -61,6 +61,16 @@ export interface Translation {
|
||||
contentMeta: {
|
||||
readingTime: (variables: { minutes: number }) => string
|
||||
}
|
||||
encryption: {
|
||||
title: string
|
||||
restricted: string
|
||||
enterPassword: string
|
||||
decrypt: string
|
||||
decrypting: string
|
||||
incorrectPassword: string
|
||||
decryptionFailed: string
|
||||
encryptedDescription: string
|
||||
}
|
||||
}
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} min read`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Restricted Content 🛡️",
|
||||
restricted: "This content is restricted. Enter the password to view:",
|
||||
enterPassword: "Enter password",
|
||||
decrypt: "Decrypt",
|
||||
decrypting: "Decrypting...",
|
||||
incorrectPassword: "Incorrect password. Please try again.",
|
||||
decryptionFailed: "Decryption failed, check logs",
|
||||
encryptedDescription: "This file is encrypted. Open it to see the contents.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} min read`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Restricted Content 🛡️",
|
||||
restricted: "This content is restricted. Enter the password to view:",
|
||||
enterPassword: "Enter password",
|
||||
decrypt: "Decrypt",
|
||||
decrypting: "Decrypting...",
|
||||
incorrectPassword: "Incorrect password. Please try again.",
|
||||
decryptionFailed: "Decryption failed, check logs",
|
||||
encryptedDescription: "This file is encrypted. Open it to see the contents.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `Se lee en ${minutes} min`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Contenido Restringido 🛡️",
|
||||
restricted: "Este contenido está restringido. Ingrese la contraseña para ver:",
|
||||
enterPassword: "Ingrese contraseña",
|
||||
decrypt: "Desencriptar",
|
||||
decrypting: "Desencriptando...",
|
||||
incorrectPassword: "Contraseña incorrecta. Intente de nuevo.",
|
||||
decryptionFailed: "Desencriptación falló, revise los registros",
|
||||
encryptedDescription: "Este archivo está encriptado. Ábralo para ver los contenidos.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `زمان تقریبی مطالعه: ${minutes} دقیقه`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ محتوای محدود 🛡️",
|
||||
restricted: "این محتوا محدود است. رمز عبور را وارد کنید:",
|
||||
enterPassword: "رمز عبور را وارد کنید",
|
||||
decrypt: "رمزگشایی",
|
||||
decrypting: "در حال رمزگشایی...",
|
||||
incorrectPassword: "رمز عبور اشتباه است. دوباره تلاش کنید.",
|
||||
decryptionFailed: "رمزگشایی ناموفق، لاگها را بررسی کنید",
|
||||
encryptedDescription: "این فایل رمزگذاری شده است. آن را باز کنید تا محتوا را ببینید.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} min lukuaika`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Rajoitettu Sisältö 🛡️",
|
||||
restricted: "Tämä sisältö on rajoitettu. Anna salasana nähdäksesi:",
|
||||
enterPassword: "Anna salasana",
|
||||
decrypt: "Pura salaus",
|
||||
decrypting: "Puretaan salausta...",
|
||||
incorrectPassword: "Väärä salasana. Yritä uudelleen.",
|
||||
decryptionFailed: "Salauksen purku epäonnistui, tarkista lokit",
|
||||
encryptedDescription: "Tämä tiedosto on salattu. Avaa se nähdäksesi sisällön.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} min de lecture`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Contenu Restreint 🛡️",
|
||||
restricted: "Ce contenu est restreint. Entrez le mot de passe pour l'afficher :",
|
||||
enterPassword: "Entrez le mot de passe",
|
||||
decrypt: "Déchiffrer",
|
||||
decrypting: "Déchiffrement...",
|
||||
incorrectPassword: "Mot de passe incorrect. Veuillez réessayer.",
|
||||
decryptionFailed: "Échec du déchiffrement, vérifiez les journaux",
|
||||
encryptedDescription: "Ce fichier est chiffré. Ouvrez-le pour voir le contenu.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} perces olvasás`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Korlátozott Tartalom 🛡️",
|
||||
restricted: "Ez a tartalom korlátozott. Adja meg a jelszót a megtekintéshez:",
|
||||
enterPassword: "Jelszó megadása",
|
||||
decrypt: "Visszafejtés",
|
||||
decrypting: "Visszafejtés...",
|
||||
incorrectPassword: "Helytelen jelszó. Kérjük, próbálja újra.",
|
||||
decryptionFailed: "A visszafejtés sikertelen, ellenőrizze a naplókat",
|
||||
encryptedDescription: "Ez a fájl titkosított. Nyissa meg a tartalom megtekintéséhez.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} menit baca`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Konten Terbatas 🛡️",
|
||||
restricted: "Konten ini terbatas. Masukkan kata sandi untuk melihat:",
|
||||
enterPassword: "Masukkan kata sandi",
|
||||
decrypt: "Dekripsi",
|
||||
decrypting: "Mendekripsi...",
|
||||
incorrectPassword: "Kata sandi salah. Silakan coba lagi.",
|
||||
decryptionFailed: "Dekripsi gagal, periksa log",
|
||||
encryptedDescription: "File ini terenkripsi. Buka untuk melihat konten.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} minuti`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Contenuto Riservato 🛡️",
|
||||
restricted: "Questo contenuto è riservato. Inserisci la password per visualizzare:",
|
||||
enterPassword: "Inserisci password",
|
||||
decrypt: "Decripta",
|
||||
decrypting: "Decriptando...",
|
||||
incorrectPassword: "Password errata. Riprova.",
|
||||
decryptionFailed: "Decriptazione fallita, controlla i log",
|
||||
encryptedDescription: "Questo file è criptato. Aprilo per vedere i contenuti.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} min read`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ 制限されたコンテンツ 🛡️",
|
||||
restricted: "このコンテンツは制限されています。表示するにはパスワードを入力してください:",
|
||||
enterPassword: "パスワードを入力",
|
||||
decrypt: "復号化",
|
||||
decrypting: "復号化中...",
|
||||
incorrectPassword: "パスワードが間違っています。もう一度お試しください。",
|
||||
decryptionFailed: "復号化に失敗しました。ログを確認してください",
|
||||
encryptedDescription: "このファイルは暗号化されています。内容を見るには開いてください。",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} min read`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ 제한된 콘텐츠 🛡️",
|
||||
restricted: "이 콘텐츠는 제한되어 있습니다. 보려면 비밀번호를 입력하세요:",
|
||||
enterPassword: "비밀번호 입력",
|
||||
decrypt: "복호화",
|
||||
decrypting: "복호화 중...",
|
||||
incorrectPassword: "비밀번호가 틀렸습니다. 다시 시도해주세요.",
|
||||
decryptionFailed: "복호화에 실패했습니다. 로그를 확인하세요",
|
||||
encryptedDescription: "이 파일은 암호화되어 있습니다. 내용을 보려면 열어주세요.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} min skaitymo`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Apribotas Turinys 🛡️",
|
||||
restricted: "Šis turinys yra apribotas. Įveskite slaptažodį, kad peržiūrėtumėte:",
|
||||
enterPassword: "Įvesti slaptažodį",
|
||||
decrypt: "Iššifruoti",
|
||||
decrypting: "Iššifruojama...",
|
||||
incorrectPassword: "Neteisingas slaptažodis. Bandykite dar kartą.",
|
||||
decryptionFailed: "Iššifravimas nepavyko, patikrinkite žurnalus",
|
||||
encryptedDescription: "Šis failas yra užšifruotas. Atidarykite jį, kad pamatytumėte turinį.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} min lesning`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Begrenset Innhold 🛡️",
|
||||
restricted: "Dette innholdet er begrenset. Skriv inn passord for å vise:",
|
||||
enterPassword: "Skriv inn passord",
|
||||
decrypt: "Dekrypter",
|
||||
decrypting: "Dekrypterer...",
|
||||
incorrectPassword: "Feil passord. Prøv igjen.",
|
||||
decryptionFailed: "Dekryptering mislyktes, sjekk logger",
|
||||
encryptedDescription: "Denne filen er kryptert. Åpne den for å se innholdet.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -60,6 +60,16 @@ export default {
|
||||
readingTime: ({ minutes }) =>
|
||||
minutes === 1 ? "1 minuut leestijd" : `${minutes} minuten leestijd`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Beperkte Inhoud 🛡️",
|
||||
restricted: "Deze inhoud is beperkt. Voer het wachtwoord in om te bekijken:",
|
||||
enterPassword: "Voer wachtwoord in",
|
||||
decrypt: "Ontsleutelen",
|
||||
decrypting: "Ontsleutelen...",
|
||||
incorrectPassword: "Onjuist wachtwoord. Probeer opnieuw.",
|
||||
decryptionFailed: "Ontsleuteling mislukt, controleer logs",
|
||||
encryptedDescription: "Dit bestand is versleuteld. Open het om de inhoud te zien.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} min. czytania `,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Ograniczona Treść 🛡️",
|
||||
restricted: "Ta treść jest ograniczona. Wprowadź hasło, aby wyświetlić:",
|
||||
enterPassword: "Wprowadź hasło",
|
||||
decrypt: "Odszyfruj",
|
||||
decrypting: "Odszyfrowywanie...",
|
||||
incorrectPassword: "Nieprawidłowe hasło. Spróbuj ponownie.",
|
||||
decryptionFailed: "Odszyfrowanie nie powiodło się, sprawdź logi",
|
||||
encryptedDescription: "Ten plik jest zaszyfrowany. Otwórz go, aby zobaczyć zawartość.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `Leitura de ${minutes} min`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Conteúdo Restrito 🛡️",
|
||||
restricted: "Este conteúdo é restrito. Digite a senha para visualizar:",
|
||||
enterPassword: "Digite a senha",
|
||||
decrypt: "Descriptografar",
|
||||
decrypting: "Descriptografando...",
|
||||
incorrectPassword: "Senha incorreta. Tente novamente.",
|
||||
decryptionFailed: "Descriptografia falhou, verifique os logs",
|
||||
encryptedDescription: "Este arquivo está criptografado. Abra-o para ver o conteúdo.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -60,6 +60,16 @@ export default {
|
||||
readingTime: ({ minutes }) =>
|
||||
minutes == 1 ? `lectură de 1 minut` : `lectură de ${minutes} minute`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Conținut Restricționat 🛡️",
|
||||
restricted: "Acest conținut este restricționat. Introduceți parola pentru a vizualiza:",
|
||||
enterPassword: "Introduceți parola",
|
||||
decrypt: "Decriptați",
|
||||
decrypting: "Se decriptează...",
|
||||
incorrectPassword: "Parolă incorectă. Încercați din nou.",
|
||||
decryptionFailed: "Decriptarea a eșuat, verificați jurnalele",
|
||||
encryptedDescription: "Acest fișier este criptat. Deschideți-l pentru a vedea conținutul.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -60,6 +60,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `время чтения ~${minutes} мин.`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Ограниченный Контент 🛡️",
|
||||
restricted: "Этот контент ограничен. Введите пароль для просмотра:",
|
||||
enterPassword: "Введите пароль",
|
||||
decrypt: "Расшифровать",
|
||||
decrypting: "Расшифровка...",
|
||||
incorrectPassword: "Неверный пароль. Попробуйте снова.",
|
||||
decryptionFailed: "Расшифровка не удалась, проверьте логи",
|
||||
encryptedDescription: "Этот файл зашифрован. Откройте его, чтобы увидеть содержимое.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `อ่านราว ${minutes} นาที`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ เนื้อหาถูกจำกัด 🛡️",
|
||||
restricted: "เนื้อหานี้ถูกจำกัด กรุณาใส่รหัสผ่านเพื่อดู:",
|
||||
enterPassword: "ใส่รหัสผ่าน",
|
||||
decrypt: "ถอดรหัส",
|
||||
decrypting: "กำลังถอดรหัส...",
|
||||
incorrectPassword: "รหัสผ่านไม่ถูกต้อง กรุณาลองใหม่",
|
||||
decryptionFailed: "การถอดรหัสล้มเหลว ตรวจสอบบันทึก",
|
||||
encryptedDescription: "ไฟล์นี้ถูกเข้ารหัส เปิดเพื่อดูเนื้อหา",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} dakika okuma süresi`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Kısıtlı İçerik 🛡️",
|
||||
restricted: "Bu içerik kısıtlıdır. Görüntülemek için şifreyi girin:",
|
||||
enterPassword: "Şifreyi girin",
|
||||
decrypt: "Şifre çöz",
|
||||
decrypting: "Şifre çözülüyor...",
|
||||
incorrectPassword: "Yanlış şifre. Tekrar deneyin.",
|
||||
decryptionFailed: "Şifre çözme başarısız, günlükleri kontrol edin",
|
||||
encryptedDescription: "Bu dosya şifrelenmiş. İçeriği görmek için açın.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes} хв читання`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Обмежений Контент 🛡️",
|
||||
restricted: "Цей контент обмежений. Введіть пароль, щоб переглянути:",
|
||||
enterPassword: "Введіть пароль",
|
||||
decrypt: "Розшифрувати",
|
||||
decrypting: "Розшифрування...",
|
||||
incorrectPassword: "Неправильний пароль. Спробуйте ще раз.",
|
||||
decryptionFailed: "Розшифрування не вдалося, перевірте журнали",
|
||||
encryptedDescription: "Цей файл зашифрований. Відкрийте його, щоб побачити вміст.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `đọc ${minutes} phút`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ Nội Dung Bị Hạn Chế 🛡️",
|
||||
restricted: "Nội dung này bị hạn chế. Nhập mật khẩu để xem:",
|
||||
enterPassword: "Nhập mật khẩu",
|
||||
decrypt: "Giải mã",
|
||||
decrypting: "Đang giải mã...",
|
||||
incorrectPassword: "Mật khẩu sai. Vui lòng thử lại.",
|
||||
decryptionFailed: "Giải mã thất bại, kiểm tra nhật ký",
|
||||
encryptedDescription: "Tệp này đã được mã hóa. Mở để xem nội dung.",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `${minutes}分钟阅读`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ 受限内容 🛡️",
|
||||
restricted: "此内容受限制。输入密码以查看:",
|
||||
enterPassword: "输入密码",
|
||||
decrypt: "解密",
|
||||
decrypting: "解密中...",
|
||||
incorrectPassword: "密码错误。请重试。",
|
||||
decryptionFailed: "解密失败,请检查日志",
|
||||
encryptedDescription: "此文件已加密。打开以查看内容。",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -59,6 +59,16 @@ export default {
|
||||
contentMeta: {
|
||||
readingTime: ({ minutes }) => `閱讀時間約 ${minutes} 分鐘`,
|
||||
},
|
||||
encryption: {
|
||||
title: "🛡️ 受限內容 🛡️",
|
||||
restricted: "此內容受限制。輸入密碼以檢視:",
|
||||
enterPassword: "輸入密碼",
|
||||
decrypt: "解密",
|
||||
decrypting: "解密中...",
|
||||
incorrectPassword: "密碼錯誤。請重試。",
|
||||
decryptionFailed: "解密失敗,請檢查日誌",
|
||||
encryptedDescription: "此檔案已加密。打開以檢視內容。",
|
||||
},
|
||||
},
|
||||
pages: {
|
||||
rss: {
|
||||
|
||||
@ -2,6 +2,7 @@ import { Root as HTMLRoot } from "hast"
|
||||
import { toString } from "hast-util-to-string"
|
||||
import { QuartzTransformerPlugin } from "../types"
|
||||
import { escapeHTML } from "../../util/escape"
|
||||
import { i18n } from "../../i18n"
|
||||
|
||||
export interface Options {
|
||||
descriptionLength: number
|
||||
@ -24,12 +25,12 @@ export const Description: QuartzTransformerPlugin<Partial<Options>> = (userOpts)
|
||||
const opts = { ...defaultOptions, ...userOpts }
|
||||
return {
|
||||
name: "Description",
|
||||
htmlPlugins() {
|
||||
htmlPlugins(ctx) {
|
||||
return [
|
||||
() => {
|
||||
return async (tree: HTMLRoot, file) => {
|
||||
if (file.data?.encrypted) {
|
||||
file.data.description = "This file is encrypted. Open it to see the contents."
|
||||
file.data.description = i18n(ctx.cfg.configuration.locale).components.encryption.encryptedDescription
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import { Root } from "hast"
|
||||
import { toHtml } from "hast-util-to-html"
|
||||
import { fromHtml } from "hast-util-from-html"
|
||||
import { VFile } from "vfile"
|
||||
import { i18n } from "../../i18n"
|
||||
|
||||
// @ts-ignore
|
||||
import encryptScript from "../../components/scripts/encrypt.inline.ts"
|
||||
@ -153,7 +154,7 @@ export const EncryptPlugin: QuartzTransformerPlugin<Partial<Options>> = (userOpt
|
||||
},
|
||||
]
|
||||
},
|
||||
htmlPlugins() {
|
||||
htmlPlugins(ctx) {
|
||||
return [
|
||||
() => {
|
||||
return (tree: Root, file) => {
|
||||
@ -162,6 +163,9 @@ export const EncryptPlugin: QuartzTransformerPlugin<Partial<Options>> = (userOpt
|
||||
return tree // No encryption, return original tree
|
||||
}
|
||||
|
||||
const locale = ctx.cfg.configuration.locale
|
||||
const t = i18n(locale).components.encryption
|
||||
|
||||
// Convert the HTML tree to string
|
||||
const htmlContent = toHtml(tree)
|
||||
|
||||
@ -171,20 +175,20 @@ export const EncryptPlugin: QuartzTransformerPlugin<Partial<Options>> = (userOpt
|
||||
// Create a new tree with encrypted content placeholder
|
||||
const encryptedTree = fromHtml(
|
||||
`
|
||||
<div class="encrypted-content" data-encrypted="${encryptedContent}" data-config='${JSON.stringify(opts)}'>
|
||||
<div class="encrypted-content" data-encrypted="${encryptedContent}" data-config='${JSON.stringify(opts)}' data-i18n='${JSON.stringify(t)}'>
|
||||
<div class="encryption-notice">
|
||||
<h3>🛡️ Restricted Content 🛡️</h3>
|
||||
<p>This content is restricted. Enter the password to view:</p>
|
||||
<h3>${t.title}</h3>
|
||||
<p>${t.restricted}</p>
|
||||
<div class="decrypt-form">
|
||||
<input type="password" class="decrypt-password" placeholder="Enter password" />
|
||||
<button class="decrypt-button">Decrypt</button>
|
||||
<input type="password" class="decrypt-password" placeholder="${t.enterPassword}" />
|
||||
<button class="decrypt-button">${t.decrypt}</button>
|
||||
</div>
|
||||
<div class="decrypt-loading">
|
||||
<div class="loading-spinner"></div>
|
||||
<span>Decrypting...</span>
|
||||
<span>${t.decrypting}</span>
|
||||
</div>
|
||||
<div class="decrypt-error">
|
||||
Incorrect password. Please try again.
|
||||
${t.incorrectPassword}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user