From dc554790439658e5a7b5e1bda62a8d0aa9e2dc3a 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 --- .../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 8bdd1a692d..22379532e5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -328,7 +328,7 @@ [% END %] -
+
[% IF independant_branch %] @@ -496,6 +496,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 %] @@ -503,9 +506,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 dcd95fa613..9e9b9e386f 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -161,33 +161,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