Files
hugo-theme-stack/i18n/vi.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

79 lines
2.4 KiB
TOML

toggleMenu = "Hiển thị Menu"
darkMode = "Chế độ nền tối"
[list]
section = "Section"
[list.page]
one = "{{ .Count }} trang"
other = "{{ .Count }} trang"
[list.subsection]
one = "Subsection"
other = "Subsections"
[article]
back = "Trở lại"
tableOfContents = "Mục lục"
relatedContent = "Bài viết liên quan"
lastUpdatedOn = "Cập nhật lần cuối"
[article.readingTime]
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"
[widget]
[widget.archives]
title = "Lưu trữ"
more = "Còn nữa"
[widget.tagCloud]
title = "Nhãn dán"
[widget.categoriesCloud]
title = "Chuỗi bài"
[search]
title = "Tìm kiếm"
placeholder = "Nhập từ khoá ..."
resultTitle = "#PAGES_COUNT trang (#TIME_SECONDS giây)"
[footer]
builtWith = "Built with {{ .Generator }}"
designedBy = "Theme {{ .Theme }} thiết kế bởi {{ .DesignedBy }}"
[cookies]
title = "Đồng ý cookie"
text = "Chúng tôi sử dụng cookie để nâng cao trải nghiệm duyệt web của bạn và phân tích lưu lượng truy cập trang web."
acceptAll = "Chấp nhận tất cả"
deny = "Từ chối"
managePreferences = "Quản lý tùy chọn"
settingsTitle = "Tùy chọn cookie"
savePreferences = "Lưu tùy chọn"
cancel = "Hủy"
footerLink = "Cài đặt cookie"
commentsDisabled = "Bình luận bị vô hiệu hóa cho đến khi bạn chấp nhận cookie chức năng."
[cookies.necessary]
title = "Cần thiết"
text = "Những cookie này là cần thiết để trang web hoạt động và không thể vô hiệu hóa."
[cookies.analytics]
title = "Phân tích"
text = "Những cookie này giúp chúng tôi hiểu cách khách truy cập tương tác với trang web của chúng tôi."
[cookies.functional]
title = "Chức năng"
text = "Những cookie này cho phép các tính năng như bình luận và nội dung nhúng."