From dd73e527298c1c4357e48589314bfd9302323c27 Mon Sep 17 00:00:00 2001 From: welpo Date: Wed, 7 Jun 2023 01:50:43 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20custom=20quotation=20?= =?UTF-8?q?marks=20for=20multilingual=20quotes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Allows users to specify custom opening and closing quotation marks for the multilingual quote shortcode. The quotation marks can be configured per language in config.toml. If not specified, default quotation marks will be used. --- config.toml | 6 +++++ templates/shortcodes/multilingual_quote.html | 26 ++++++++++++++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/config.toml b/config.toml index dd70523..718bdfc 100644 --- a/config.toml +++ b/config.toml @@ -67,6 +67,9 @@ table_of_contents = "Tabla de contenido" last_updated_on = "Última actualización el" show_original_quote = "Mostrar cita original" show_translation = "Mostrar traducción" +# Quotation marks for multilingual quote shortcode. +open_quotation_mark = "«" +close_quotation_mark = "»" [languages.ca.translations] language_name = "Català" @@ -97,6 +100,9 @@ table_of_contents = "Taula de contingut" last_updated_on = "Última actualizació el" show_original_quote = "Mostra la cita original" show_translation = "Mostra la traducció" +# Quotation marks for multilingual quote shortcode. +open_quotation_mark = "«" +close_quotation_mark = "»" [extra] diff --git a/templates/shortcodes/multilingual_quote.html b/templates/shortcodes/multilingual_quote.html index 9263bb0..eef9e54 100644 --- a/templates/shortcodes/multilingual_quote.html +++ b/templates/shortcodes/multilingual_quote.html @@ -1,19 +1,35 @@ +{%- if lang != config.default_language -%} + {%- set open_quote = trans(key="open_quotation_mark" | safe, lang=lang) -%} + {%- set close_quote = trans(key="close_quotation_mark" | safe, lang=lang) -%} +{%- else -%} + {%- set open_quote = "“" -%} + {%- set close_quote = "”" -%} +{%- endif -%} +
-

"{{ translated }}"

+

{{ open_quote ~ translated ~ close_quote }}

— {{ author }}

+ ({%- if lang != config.default_language -%} + {{ trans(key="show_original_quote" | safe, lang=lang) }} + {%- else -%} + Show original quote + {%- endif -%})

-

"{{ original }}"

+

{{ open_quote ~ original ~ close_quote }}

— {{ author }}

+ ({%- if lang != config.default_language -%} + {{ trans(key="show_translation" | safe, lang=lang) }} + {%- else -%} + Show translation + {%- endif -%}) +