Files
hugo-theme-stack/i18n/th.toml
T
4ad88a327e feat: add GDPR cookie consent banner (#1216)
* feat: add GDPR cookie consent banner

Add a GDPR-compliant cookie consent banner that gates analytics (Google
Analytics) and functional cookies (comments) until user consent is given.

Features:
- Theme-consistent styling using CSS variables (light/dark mode)
- Settings panel with category toggles (necessary, analytics, functional)
- Consent stored in cookie for 365 days
- Google Analytics only loads after analytics consent
- Comments only load after functional consent
- Translations for all 32 supported languages
- Accessible with proper ARIA attributes and focus management

Configuration in hugo.yaml:
  params:
    cookies:
      enabled: true
      categories:
        analytics: true
        functional: true

When cookies.enabled is false, scripts load normally without consent gating.

Closes #412

* refactor: move consent-gated GA to cookies/analytics.html

Move Google Analytics consent logic to avoid shadowing Hugo's internal
`_internal/google_analytics.html` template.

Changes:
- Rename google_analytics.html → cookies/analytics.html
- Update head.html to conditionally load:
  - cookies.enabled=true: cookies/analytics.html (consent-gated)
  - cookies.enabled=false: Hugo's _internal/google_analytics.html
- Align cookies/analytics.html with Hugo's internal template:
  - Support Privacy.GoogleAnalytics.Disable setting
  - Support Privacy.GoogleAnalytics.RespectDoNotTrack setting
  - Add UA- prefix deprecation warning

Note: Custom JS is required for consent-gated GA because Hugo templates
render at build time, but consent happens at runtime. We cannot call
Hugo's internal template after the user grants consent - we must
dynamically inject the GA script via JavaScript.

* style: indent cookies/analytics.html

* refactor: don't use default, put default configurations in params.toml

* fix: don't use `description` as translation key because it's reserved and will throw error

* fix: remove footer/components/custom-font.html call

* fix: banner showSettings key

* style: indent comments/include

* Add missing article.alert translation back

* style: format i18n toml files

* style: indent head/head.html

* style adjustment

* style: add missing -

* style: format demo/config/params.toml

* style: remove redundant comments from cookies.scss

* style: update box-shadow for cookie banner content

---------

Co-authored-by: delize <4028612+delize@users.noreply.github.com>
Co-authored-by: Jimmy Cai <jimmy@cai.im>
2026-02-19 17:21:25 +01:00

76 lines
3.7 KiB
TOML

toggleMenu = "สลับเมนู"
darkMode = "ธีมมืด"
[list]
section = "หมวดหมู่"
[list.page]
one = "{{ .Count }} หน้า"
other = "{{ .Count }} หน้า"
[list.subsection]
one = "หมวดหมู่ย่อย"
other = "หมวดหมู่ย่อยอื่นๆ"
[article]
back = "กลับไป"
tableOfContents = "สารบัญ"
relatedContent = "เนื้อหาคล้ายคลึงกัน"
lastUpdatedOn = "อัปเดตล่าสุดเมื่อ"
[article.readingTime]
one = "น่าจะใช้เวลา {{ .Count }} นาทีในการอ่าน"
other = "น่าจะใช้เวลา {{ .Count }} นาทีในการอ่าน"
[article.alert]
note = "หมายเหตุ"
tip = "เคล็ดลับ"
important = "สำคัญ"
warning = "คำเตือน"
caution = "ระวัง"
[notFound]
title = "ไม่พบหัวข้อ"
subtitle = "ไม่พบหน้านี้ในระบบ"
[widget]
[widget.archives]
title = "เนื้อหาที่เก็บถาวรแล้ว"
more = "อื่นๆ นอกจากนี้"
[widget.tagCloud]
title = "แท็ก"
[search]
title = "ค้นหา"
placeholder = "พิมพ์เพื่อค้นหา ..."
resultTitle = "#PAGES_COUNT pages (#TIME_SECONDS seconds)"
[footer]
builtWith = "ถูกสร้างด้วย {{ .Generator }}"
designedBy = "ธีม {{ .Theme }} ออกแบบโดย {{ .DesignedBy }}"
[cookies]
title = "ความยินยอมคุกกี้"
text = "เราใช้คุกกี้เพื่อปรับปรุงประสบการณ์การเรียกดูของคุณและวิเคราะห์การเข้าชมเว็บไซต์"
acceptAll = "ยอมรับทั้งหมด"
deny = "ปฏิเสธ"
managePreferences = "จัดการการตั้งค่า"
settingsTitle = "การตั้งค่าคุกกี้"
savePreferences = "บันทึกการตั้งค่า"
cancel = "ยกเลิก"
footerLink = "การตั้งค่าคุกกี้"
commentsDisabled = "ความคิดเห็นถูกปิดการใช้งานจนกว่าคุณจะยอมรับคุกกี้เชิงหน้าที่"
[cookies.necessary]
title = "จำเป็น"
text = "คุกกี้เหล่านี้จำเป็นสำหรับการทำงานของเว็บไซต์และไม่สามารถปิดการใช้งานได้"
[cookies.analytics]
title = "การวิเคราะห์"
text = "คุกกี้เหล่านี้ช่วยให้เราเข้าใจว่าผู้เยี่ยมชมโต้ตอบกับเว็บไซต์ของเราอย่างไร"
[cookies.functional]
title = "เชิงหน้าที่"
text = "คุกกี้เหล่านี้เปิดใช้งานคุณสมบัติต่างๆ เช่น ความคิดเห็นและเนื้อหาที่ฝังไว้"