From ca8c6d34991ee3ea40e22ccd8aa9df65ed3b3563 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 24 Apr 2024 14:44:05 +0100 Subject: [PATCH] Bug 33237: Add display of which language default language is expected This patch adds the display of 'Default language' to the 'Default' language in the notices editor tool. This is so that librarians know which language they are expected to be writing the notice in so we can remain consistent in both template and include language used. Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit dc554790439658e5a7b5e1bda62a8d0aa9e2dc3a) Signed-off-by: Fridolin Somers --- .../prog/en/modules/tools/letter.tt | 10 ++++++- tools/letter.pl | 29 +++++++++---------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 3dea27a8a5..e1a53bdee6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -318,7 +318,7 @@ [% END %] -
+
[% IF independant_branch %] @@ -481,6 +481,9 @@ [% WRAPPER tab_panels %] [% FOREACH lang IN letters.keys %] [% WRAPPER tab_panel tabname="lang_${lang}" %] + [% IF lang == 'default' %] +

Default language: [% default_language | html %]

+ [% END %] [% PROCESS message_templates %] [% END # /WRAPPER tab_panel %] [% END # /FOREACH lang %] @@ -488,9 +491,14 @@ [% END # /WRAPPER tabs#tabs %] [% ELSE %]
+
[% FOREACH lang IN letters.keys %] + [% IF lang == 'default' %] +

Default language: [% default_language | html %]

+ [% END %] [% PROCESS message_templates %] [% END # /FOREACH lang %] +
[% END # /IF TranslateNotices %] diff --git a/tools/letter.pl b/tools/letter.pl index 95ac3ea126..cdbe3afce2 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -162,33 +162,32 @@ sub add_form { my $templates = { map { $_ => { message_transport_type => $_ } } sort @$message_transport_types }; my %letters = ( default => { templates => $templates } ); + my $translated_languages = C4::Languages::getTranslatedLanguages( + 'opac', + C4::Context->preference('template') + ); if ( C4::Context->preference('TranslateNotices') ) { - my $translated_languages = - C4::Languages::getTranslatedLanguages( 'opac', - C4::Context->preference('template') ); for my $language (@$translated_languages) { - for my $sublanguage( @{ $language->{sublanguages_loop} } ) { + for my $sublanguage ( @{ $language->{sublanguages_loop} } ) { if ( $language->{plural} ) { $letters{ $sublanguage->{rfc4646_subtag} } = { - description => $sublanguage->{native_description} - . ' ' - . $sublanguage->{region_description} . ' (' - . $sublanguage->{rfc4646_subtag} . ')', - templates => { %$templates }, + description => $sublanguage->{native_description} . ' ' + . $sublanguage->{region_description} . ' (' + . $sublanguage->{rfc4646_subtag} . ')', + templates => {%$templates}, }; - } - else { + } else { $letters{ $sublanguage->{rfc4646_subtag} } = { - description => $sublanguage->{native_description} - . ' (' - . $sublanguage->{rfc4646_subtag} . ')', - templates => { %$templates }, + description => $sublanguage->{native_description} . ' (' . $sublanguage->{rfc4646_subtag} . ')', + templates => {%$templates}, }; } } } $template->param( languages => $translated_languages ); } + my $default_language = @{ @{$translated_languages}[0]->{sublanguages_loop} }[0]->{native_description}; + $template->param( default_language => $default_language ); if ($letters) { $template->param( modify => 1, -- 2.39.5