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

70 lines
2.3 KiB
TOML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
toggleMenu = "メニューを開く・閉じる"
darkMode = "ダークモード"
[list]
page = "{{ .Count }} ページ目"
section = "セクション"
subsection = "サブセクション"
[article]
back = "前のページ"
tableOfContents = "目次"
relatedContent = "関連するコンテンツ"
lastUpdatedOn = "最終更新"
readingTime = "読了時間: {{ .Count }}分"
[article.alert]
note = "注記"
tip = "ヒント"
important = "重要"
warning = "警告"
caution = "注意"
[notFound]
title = "404 Not Found"
subtitle = "指定されたページは存在しません。"
[widget]
[widget.archives]
title = "アーカイブ"
more = "さらに見る"
[widget.tagCloud]
title = "タグ"
[widget.categoriesCloud]
title = "カテゴリ"
[search]
title = "検索"
placeholder = "入力..."
resultTitle = "#PAGES_COUNT 件 #TIME_SECONDS 秒)"
[footer]
builtWith = "{{ .Generator }} で構築されています。"
designedBy = "テーマ {{ .Theme }} は {{ .DesignedBy }} によって設計されています。"
[cookies]
title = "Cookieの同意"
text = "ブラウジング体験を向上させ、サイトトラフィックを分析するためにCookieを使用しています。"
acceptAll = "すべて受け入れる"
deny = "拒否"
managePreferences = "設定を管理"
settingsTitle = "Cookie設定"
savePreferences = "設定を保存"
cancel = "キャンセル"
footerLink = "Cookie設定"
commentsDisabled = "機能的なCookieを受け入れるまで、コメントは無効になっています。"
[cookies.necessary]
title = "必須"
text = "これらのCookieはウェブサイトの機能に必要であり、無効にすることはできません。"
[cookies.analytics]
title = "分析"
text = "これらのCookieは、訪問者が当サイトとどのように対話するかを理解するのに役立ちます。"
[cookies.functional]
title = "機能的"
text = "これらのCookieは、コメントや埋め込みコンテンツなどの機能を有効にします."