feat(i18n): add i18n support for Markdown alert (#1269)
* docs: add blockquote with custom alert title * feat: add alert types to i18n and update blockquote rendering * fix: wrong translation key * feat: add alert title translation for all supported languages Done by AI
This commit is contained in:
@@ -52,6 +52,9 @@ The blockquote element represents content that is quoted from another source, op
|
||||
> [!NOTE]
|
||||
> Highlights information that users should take into account, even when skimming.
|
||||
|
||||
> [!NOTE] Custom title
|
||||
> You can also provide a custom title for the note alert.
|
||||
|
||||
> [!TIP]
|
||||
> Optional information to help a user be more successful.
|
||||
|
||||
|
||||
@@ -64,6 +64,9 @@ Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sap
|
||||
> [!CAUTION]
|
||||
> 某个操作可能带来的负面后果。
|
||||
|
||||
> [!NOTE] 自定义标题
|
||||
> 如果你想使用自定义标题,可以在方括号后面添加标题文本,如上所示。
|
||||
|
||||
## 表格 (Tables)
|
||||
|
||||
表格虽然不是 Markdown 核心规范的一部分,但 Hugo 出箱即用地支持它们。
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "الوضع الداكن"
|
||||
one = "تُقرأ خلال دقيقة"
|
||||
other = "تُقرأ خلال {{ .Count }} دقائق"
|
||||
|
||||
[article.alert]
|
||||
note = "ملاحظة"
|
||||
tip = "نصيحة"
|
||||
important = "مهم"
|
||||
warning = "تحذير"
|
||||
caution = "تنبيه"
|
||||
|
||||
[notFound]
|
||||
title = "غير موجود"
|
||||
subtitle = "تعذر العثور على الصفحة المطلوبة."
|
||||
|
||||
@@ -23,6 +23,13 @@ darkMode = "Цёмны рэжым"
|
||||
tableOfContents = "Змест"
|
||||
readingTime = "Час чытання: {{ .Count }} хв."
|
||||
|
||||
[article.alert]
|
||||
note = "Заўвага"
|
||||
tip = "Парада"
|
||||
important = "Важна"
|
||||
warning = "Папярэджанне"
|
||||
caution = "Асцярога"
|
||||
|
||||
[notFound]
|
||||
title = "Не знойдзена"
|
||||
subtitle = "Запытваемая старонка не існуе"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Тъмен Режим"
|
||||
one = "{{ .Count }} minute read"
|
||||
other = "{{ .Count }} minute read"
|
||||
|
||||
[article.alert]
|
||||
note = "Бележка"
|
||||
tip = "Съвет"
|
||||
important = "Важно"
|
||||
warning = "Предупреждение"
|
||||
caution = "Внимание"
|
||||
|
||||
[notFound]
|
||||
title = "Не е намерено"
|
||||
subtitle = "Страницата която търсите не е открита"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "ডার্ক মোড"
|
||||
one = "{{ .Count }} মিনিটে পড়া যাবে"
|
||||
other = "{{ .Count }} মিনিটে পড়া যাবে"
|
||||
|
||||
[article.alert]
|
||||
note = "টীকা"
|
||||
tip = "পরামর্শ"
|
||||
important = "গুরুত্বপূর্ণ"
|
||||
warning = "সতর্কতা"
|
||||
caution = "সাবধানতা"
|
||||
|
||||
[notFound]
|
||||
title = "পাওয়া যায়নি"
|
||||
subtitle = "এই পাতাটি বিদ্যমান নেই"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Mode fosc"
|
||||
one = "{{ .Count }} minut a llegir"
|
||||
other = "{{ .Count }} minuts a llegir"
|
||||
|
||||
[article.alert]
|
||||
note = "Nota"
|
||||
tip = "Consell"
|
||||
important = "Important"
|
||||
warning = "Avís"
|
||||
caution = "Precaució"
|
||||
|
||||
[notFound]
|
||||
title = "No Trobat"
|
||||
subtitle = "Aquesta pàgina no existeix"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Tmavý režim"
|
||||
one = "{{ .Count }} minuta"
|
||||
other = "{{ .Count }} minut"
|
||||
|
||||
[article.alert]
|
||||
note = "Poznámka"
|
||||
tip = "Tip"
|
||||
important = "Důležité"
|
||||
warning = "Varování"
|
||||
caution = "Upozornění"
|
||||
|
||||
[notFound]
|
||||
title = "Nenalezeno"
|
||||
subtitle = "Tato stránka neexistuje"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Dunkler Modus"
|
||||
one = "{{ .Count }} Minute Lesezeit"
|
||||
other = "{{ .Count }} Minuten Lesezeit"
|
||||
|
||||
[article.alert]
|
||||
note = "Hinweis"
|
||||
tip = "Tipp"
|
||||
important = "Wichtig"
|
||||
warning = "Warnung"
|
||||
caution = "Vorsicht"
|
||||
|
||||
[notFound]
|
||||
title = "Seite nicht gefunden"
|
||||
subtitle = "Diese Seite existiert nicht"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Σκοτεινό θέμα"
|
||||
one = "{{ .Count }} λεπτό ανάγνωσης"
|
||||
other = "{{ .Count }} λεπτά ανάγνωσης"
|
||||
|
||||
[article.alert]
|
||||
note = "Σημείωση"
|
||||
tip = "Συμβουλή"
|
||||
important = "Σημαντικό"
|
||||
warning = "Προειδοποίηση"
|
||||
caution = "Προσοχή"
|
||||
|
||||
[notFound]
|
||||
title = "Δε βρέθηκε"
|
||||
subtitle = "Η σελίδα δε βρέθηκε."
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Dark Mode"
|
||||
one = "{{ .Count }} minute read"
|
||||
other = "{{ .Count }} minutes read"
|
||||
|
||||
[article.alert]
|
||||
note = "Note"
|
||||
tip = "Tip"
|
||||
important = "Important"
|
||||
warning = "Warning"
|
||||
caution = "Caution"
|
||||
|
||||
[notFound]
|
||||
title = "Not Found"
|
||||
subtitle = "This page does not exist"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Modo oscuro"
|
||||
one = "Tiempo de lectura {{ .Count }} minuto"
|
||||
other = "Tiempo de lectura {{ .Count }} minutos"
|
||||
|
||||
[article.alert]
|
||||
note = "Nota"
|
||||
tip = "Consejo"
|
||||
important = "Importante"
|
||||
warning = "Advertencia"
|
||||
caution = "Precaución"
|
||||
|
||||
[notFound]
|
||||
title = "No Encontrado"
|
||||
subtitle = "Esta página no existe"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "حالت شب"
|
||||
one = "مطالعه در {{ .Count }} دقیقه"
|
||||
other = "مطالعه در {{ .Count }} دقیقه"
|
||||
|
||||
[article.alert]
|
||||
note = "یادداشت"
|
||||
tip = "نکته"
|
||||
important = "مهم"
|
||||
warning = "هشدار"
|
||||
caution = "احتیاط"
|
||||
|
||||
[notFound]
|
||||
title = "یافت نشد"
|
||||
subtitle = "این صحه وجود ندارد"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Mode sombre"
|
||||
one = "{{ .Count }} minute de lecture"
|
||||
other = "{{ .Count }} minutes de lecture"
|
||||
|
||||
[article.alert]
|
||||
note = "Note"
|
||||
tip = "Astuce"
|
||||
important = "Important"
|
||||
warning = "Avertissement"
|
||||
caution = "Attention"
|
||||
|
||||
[notFound]
|
||||
title = "Page non trouvée"
|
||||
subtitle = "Cette page n'existe pas."
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "डार्क मोड"
|
||||
one = "{{ .Count }} मिनट पढ़ें"
|
||||
other = "{{ .Count }} मिनट पढ़ें"
|
||||
|
||||
[article.alert]
|
||||
note = "नोट"
|
||||
tip = "सलाह"
|
||||
important = "महत्वपूर्ण"
|
||||
warning = "चेतावनी"
|
||||
caution = "सावधानी"
|
||||
|
||||
[notFound]
|
||||
title = "404 नहीं मिला।"
|
||||
subtitle = "यह पृष्ठ मौजूद नहीं है।"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Sötét Mód"
|
||||
one = "{{ .Count }} percnyi olvasmány"
|
||||
other = "{{ .Count }} percnyi olvasmány"
|
||||
|
||||
[article.alert]
|
||||
note = "Megjegyzés"
|
||||
tip = "Tipp"
|
||||
important = "Fontos"
|
||||
warning = "Figyelmeztetés"
|
||||
caution = "Óvatosság"
|
||||
|
||||
[notFound]
|
||||
title = "Nem található"
|
||||
subtitle = "Ez az oldal nem létezik"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Mode Gelap"
|
||||
one = "Waktu Membaca: {{ .Count }} menit"
|
||||
other = "Waktu Membaca: {{ .Count }} menit"
|
||||
|
||||
[article.alert]
|
||||
note = "Catatan"
|
||||
tip = "Tips"
|
||||
important = "Penting"
|
||||
warning = "Peringatan"
|
||||
caution = "Perhatian"
|
||||
|
||||
[notFound]
|
||||
title = "Tidak ditemukan"
|
||||
subtitle = "Halaman yang Anda akses tidak ditemukan."
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Modalità scura"
|
||||
one = "{{ .Count }} min per leggere"
|
||||
other = "{{ .Count }} min per leggere"
|
||||
|
||||
[article.alert]
|
||||
note = "Nota"
|
||||
tip = "Suggerimento"
|
||||
important = "Importante"
|
||||
warning = "Avvertenza"
|
||||
caution = "Attenzione"
|
||||
|
||||
[notFound]
|
||||
title = "Non trovato"
|
||||
subtitle = "Questa pagina non esiste."
|
||||
|
||||
@@ -13,6 +13,13 @@ darkMode = "ダークモード"
|
||||
lastUpdatedOn = "最終更新"
|
||||
readingTime = "読了時間: {{ .Count }}分"
|
||||
|
||||
[article.alert]
|
||||
note = "注記"
|
||||
tip = "ヒント"
|
||||
important = "重要"
|
||||
warning = "警告"
|
||||
caution = "注意"
|
||||
|
||||
[notFound]
|
||||
title = "404 Not Found"
|
||||
subtitle = "指定されたページは存在しません。"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "다크 모드"
|
||||
one = "{{ .Count }} 분 정도"
|
||||
other = "{{ .Count }} 분 정도"
|
||||
|
||||
[article.alert]
|
||||
note = "참고"
|
||||
tip = "팁"
|
||||
important = "중요"
|
||||
warning = "경고"
|
||||
caution = "주의"
|
||||
|
||||
[notFound]
|
||||
title = "찾을 수 없음"
|
||||
subtitle = "페이지를 찾을 수 없습니다."
|
||||
|
||||
@@ -17,6 +17,13 @@ darkMode = "Donkere modus"
|
||||
lastUpdatedOn = "Laatst bijgewerkt op"
|
||||
readingTime = "{{ .Count }} leestijd"
|
||||
|
||||
[article.alert]
|
||||
note = "Opmerking"
|
||||
tip = "Tip"
|
||||
important = "Belangrijk"
|
||||
warning = "Waarschuwing"
|
||||
caution = "Let op"
|
||||
|
||||
[notFound]
|
||||
title = "Niet gevonden"
|
||||
subtitle = "Deze pagina bestaat niet."
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Mòde fosc"
|
||||
one = "{{ .Count }} minuta de lectura"
|
||||
other = "{{ .Count }} minutas de lectura"
|
||||
|
||||
[article.alert]
|
||||
note = "Nòta"
|
||||
tip = "Conselh"
|
||||
important = "Important"
|
||||
warning = "Avertiment"
|
||||
caution = "Atencion"
|
||||
|
||||
[notFound]
|
||||
title = "Non trobat"
|
||||
subtitle = "Aquesta pagina existís pas"
|
||||
|
||||
@@ -28,6 +28,13 @@ darkMode = "Tryb ciemny"
|
||||
many = "Przeczytasz w {{ .Count }} minut"
|
||||
other = "Przeczytasz w {{ .Count }} minut"
|
||||
|
||||
[article.alert]
|
||||
note = "Notatka"
|
||||
tip = "Wskazówka"
|
||||
important = "Ważne"
|
||||
warning = "Ostrzeżenie"
|
||||
caution = "Uwaga"
|
||||
|
||||
[notFound]
|
||||
title = "Nie znaleziono"
|
||||
subtitle = "Ta strona nie istnieje"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Modo Escuro"
|
||||
one = "{{ .Count }} minuto de leitura"
|
||||
other = "{{ .Count }} minutos de leitura"
|
||||
|
||||
[article.alert]
|
||||
note = "Nota"
|
||||
tip = "Dica"
|
||||
important = "Importante"
|
||||
warning = "Aviso"
|
||||
caution = "Cuidado"
|
||||
|
||||
[notFound]
|
||||
title = "Não Encontrado"
|
||||
subtitle = "Esta página não existe."
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Modo Escuro"
|
||||
one = "{{ .Count }} minuto de leitura"
|
||||
other = "{{ .Count }} minutos de leitura"
|
||||
|
||||
[article.alert]
|
||||
note = "Nota"
|
||||
tip = "Dica"
|
||||
important = "Importante"
|
||||
warning = "Aviso"
|
||||
caution = "Cuidado"
|
||||
|
||||
[notFound]
|
||||
title = "Não Encontrado"
|
||||
subtitle = "Esta página não existe."
|
||||
|
||||
@@ -23,6 +23,13 @@ darkMode = "Тёмный режим"
|
||||
tableOfContents = "Содержание"
|
||||
readingTime = "Время чтения: {{ .Count }} мин."
|
||||
|
||||
[article.alert]
|
||||
note = "Примечание"
|
||||
tip = "Совет"
|
||||
important = "Важно"
|
||||
warning = "Предупреждение"
|
||||
caution = "Осторожно"
|
||||
|
||||
[notFound]
|
||||
title = "Не найдено"
|
||||
subtitle = "Запрашиваемая страница не существует"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Tmavý režim"
|
||||
one = "{{ .Count }} minúta"
|
||||
other = "{{ .Count }} minút"
|
||||
|
||||
[article.alert]
|
||||
note = "Poznámka"
|
||||
tip = "Tip"
|
||||
important = "Dôležité"
|
||||
warning = "Varovanie"
|
||||
caution = "Upozornenie"
|
||||
|
||||
[notFound]
|
||||
title = "Nenájdené"
|
||||
subtitle = "Tato stránka neexistuje"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "ธีมมืด"
|
||||
one = "น่าจะใช้เวลา {{ .Count }} นาทีในการอ่าน"
|
||||
other = "น่าจะใช้เวลา {{ .Count }} นาทีในการอ่าน"
|
||||
|
||||
[article.alert]
|
||||
note = "หมายเหตุ"
|
||||
tip = "เคล็ดลับ"
|
||||
important = "สำคัญ"
|
||||
warning = "คำเตือน"
|
||||
caution = "ระวัง"
|
||||
|
||||
[notFound]
|
||||
title = "ไม่พบหัวข้อ"
|
||||
subtitle = "ไม่พบหน้านี้ในระบบ"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Koyu Mod"
|
||||
one = "{{ .Count }} dakika okuma süresi"
|
||||
other = "{{ .Count }} dakika okuma süresi"
|
||||
|
||||
[article.alert]
|
||||
note = "Not"
|
||||
tip = "İpucu"
|
||||
important = "Önemli"
|
||||
warning = "Uyarı"
|
||||
caution = "Dikkat"
|
||||
|
||||
[notFound]
|
||||
title = "Bulunamadı"
|
||||
subtitle = "Aradığınız sayfa mevcut değil."
|
||||
|
||||
@@ -23,6 +23,13 @@ darkMode = "Темна тема"
|
||||
one = "Час читання: {{ .Count }} хв"
|
||||
other = "Час читання: {{ .Count }} хв"
|
||||
|
||||
[article.alert]
|
||||
note = "Примітка"
|
||||
tip = "Порада"
|
||||
important = "Важливо"
|
||||
warning = "Попередження"
|
||||
caution = "Обережно"
|
||||
|
||||
[notFound]
|
||||
title = "Не знайдено"
|
||||
subtitle = "Ця сторінка не існує"
|
||||
|
||||
@@ -22,6 +22,13 @@ darkMode = "Chế độ nền tối"
|
||||
one = "{{ .Count }} phút đọc"
|
||||
other = "{{ .Count }} phút đọc"
|
||||
|
||||
[article.alert]
|
||||
note = "Ghi chú"
|
||||
tip = "Mẹo"
|
||||
important = "Quan trọng"
|
||||
warning = "Cảnh báo"
|
||||
caution = "Thận trọng"
|
||||
|
||||
[notFound]
|
||||
title = "Không tìm thấy"
|
||||
subtitle = "Trang này không tồn tại"
|
||||
|
||||
@@ -13,6 +13,13 @@ darkMode = "深色模式"
|
||||
lastUpdatedOn = "上次改過於"
|
||||
readingTime = "閱讀時間 {{ .Count }} 分鐘"
|
||||
|
||||
[article.alert]
|
||||
note = "備註"
|
||||
tip = "提示"
|
||||
important = "重要"
|
||||
warning = "警告"
|
||||
caution = "注意"
|
||||
|
||||
[notFound]
|
||||
title = "找不到頁面"
|
||||
subtitle = "本頁面並不存在"
|
||||
|
||||
@@ -13,6 +13,13 @@ darkMode = "夜晚模式"
|
||||
lastUpdatedOn = "最後更新"
|
||||
readingTime = "閱讀時間: {{ .Count }} 分鐘"
|
||||
|
||||
[article.alert]
|
||||
note = "備註"
|
||||
tip = "提示"
|
||||
important = "重要"
|
||||
warning = "警告"
|
||||
caution = "注意"
|
||||
|
||||
[notFound]
|
||||
title = "404 錯誤"
|
||||
subtitle = "頁面不存在"
|
||||
|
||||
@@ -13,6 +13,13 @@ darkMode = "暗色模式"
|
||||
lastUpdatedOn = "最后更新于"
|
||||
readingTime = "阅读时长: {{ .Count }} 分钟"
|
||||
|
||||
[article.alert]
|
||||
note = "备注"
|
||||
tip = "提示"
|
||||
important = "重要"
|
||||
warning = "警告"
|
||||
caution = "注意"
|
||||
|
||||
[notFound]
|
||||
title = "404 错误"
|
||||
subtitle = "页面不存在"
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
{{- $type := .AlertType -}}
|
||||
{{- $icons := site.Params.article.alertIcon -}}
|
||||
{{- $icon := index $icons $type -}}
|
||||
|
||||
<blockquote class="{{ if $type }}alert alert-{{ $type }}{{ end }}">
|
||||
{{- if $type -}}
|
||||
{{ if eq .Type "alert" }}
|
||||
{{- $type := .AlertType -}}
|
||||
{{- $icons := site.Params.article.alertIcon -}}
|
||||
{{- $icon := index $icons $type -}}
|
||||
<blockquote class="alert alert-{{ $type }}">
|
||||
<div class="alert-header">
|
||||
<span class="alert-icon">
|
||||
{{- $icon -}}
|
||||
</span>
|
||||
<span class="alert-title">
|
||||
{{- title $type -}}
|
||||
{{- with .AlertTitle -}}
|
||||
{{ . }}
|
||||
{{- else -}}
|
||||
{{ or (i18n (printf "article.alert.%s" $type)) (title $type) }}
|
||||
{{- end -}}
|
||||
</span>
|
||||
</div>
|
||||
{{- end -}}
|
||||
|
||||
<div class="alert-body">
|
||||
<div class="alert-body">
|
||||
{{ .Text }}
|
||||
</div>
|
||||
</blockquote>
|
||||
{{ else }}
|
||||
<blockquote>
|
||||
{{ .Text }}
|
||||
</div>
|
||||
</blockquote>
|
||||
</blockquote>
|
||||
{{ end }}
|
||||
Reference in New Issue
Block a user