From 2b498d9bfb9a0276cd4b6a45f42172302c7e1a6e Mon Sep 17 00:00:00 2001 From: Tim Bannister Date: Tue, 14 May 2024 01:06:55 +0100 Subject: [PATCH] Make tooltip localizable Allow localizations to customize the tooltip for copying code samples to the clipboard. --- data/i18n/en/en.toml | 3 +++ layouts/shortcodes/code.html | 3 ++- layouts/shortcodes/code_sample.html | 3 ++- layouts/shortcodes/codenew.html | 3 ++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/data/i18n/en/en.toml b/data/i18n/en/en.toml index 80f1306f287e5..b16e8b6e042a6 100644 --- a/data/i18n/en/en.toml +++ b/data/i18n/en/en.toml @@ -68,6 +68,9 @@ other = "YouTube" [conjunction_1] other = "and" +[copy_sample_to_clipboard] +other = "Copy {{ .filename }} to clipboard" + [cve_id] other = "CVE ID" diff --git a/layouts/shortcodes/code.html b/layouts/shortcodes/code.html index 11f7eb8112fa6..fda3a27f13ced 100644 --- a/layouts/shortcodes/code.html +++ b/layouts/shortcodes/code.html @@ -22,8 +22,9 @@
{{ with $ghlink }}{{ end }}{{ $file }} {{ if $ghlink }}{{ end }} + {{- $copyTitle := T "copy_sample_to_clipboard" (dict "filename" $file) -}} {{- with resources.Get "images/copycode.svg" -}} - + {{- end -}}
diff --git a/layouts/shortcodes/code_sample.html b/layouts/shortcodes/code_sample.html index 11f7eb8112fa6..fda3a27f13ced 100644 --- a/layouts/shortcodes/code_sample.html +++ b/layouts/shortcodes/code_sample.html @@ -22,8 +22,9 @@
{{ with $ghlink }}{{ end }}{{ $file }} {{ if $ghlink }}{{ end }} + {{- $copyTitle := T "copy_sample_to_clipboard" (dict "filename" $file) -}} {{- with resources.Get "images/copycode.svg" -}} - + {{- end -}}
diff --git a/layouts/shortcodes/codenew.html b/layouts/shortcodes/codenew.html index 11f7eb8112fa6..fda3a27f13ced 100644 --- a/layouts/shortcodes/codenew.html +++ b/layouts/shortcodes/codenew.html @@ -22,8 +22,9 @@
{{ with $ghlink }}{{ end }}{{ $file }} {{ if $ghlink }}{{ end }} + {{- $copyTitle := T "copy_sample_to_clipboard" (dict "filename" $file) -}} {{- with resources.Get "images/copycode.svg" -}} - + {{- end -}}