From 5e9b914352a85e116e66f031431e80a37281ac30 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 27 Jun 2024 11:25:26 +0100 Subject: [PATCH] Bug 36815: (follow-up) Use correct language for default When 'default' language is set, we need to use the default as defined by the OPACLanguages system preference. Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- Koha/Notice/Template.pm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Koha/Notice/Template.pm b/Koha/Notice/Template.pm index 2377a84aec..8d0184e751 100644 --- a/Koha/Notice/Template.pm +++ b/Koha/Notice/Template.pm @@ -41,8 +41,16 @@ Returns the default notice template content. =cut sub get_default { - my $self = shift; - my $lang = $self->lang; + my $self = shift; + my $lang = $self->lang; + if ( $lang eq 'default' ) { + my $translated_languages = C4::Languages::getTranslatedLanguages( + 'opac', + C4::Context->preference('template') + ); + $lang = @{ @{$translated_languages}[0]->{sublanguages_loop} }[0]->{rfc4646_subtag}; + } + my $defaulted_to_en = 0; my $file = C4::Context->config('intranetdir') . "/installer/data/mysql/$lang/mandatory/sample_notices.yml"; -- 2.39.5