From 47a9100e022312fccaf004b19007d3b40e78bc7d Mon Sep 17 00:00:00 2001
From: Owen Leonard <oleonard@myacpl.org>
Date: Thu, 5 Sep 2024 10:53:10 +0000
Subject: [PATCH] Bug 37841: Switch OPAC language menu alignment in header and
 footer

The OPAC language menu is now generated by the same include file in both
the header and the footer. We have a switch for the menu's direction
based on this context, but we also need a switch for alignment: The menu
should extend left into the page from the header, and right into the
page from the footer.

To test you should have at least one additional language installed and
enabled. To reproduce the bug I recomment en-GB because the language
description is long enough to trigger the misalignment.

- Apply the patch and set the 'opaclanguagesdisplay' system preference
  to "Allow" and the 'OpacLangSelectorMode' preference to "both top and
  footer".
- Go to the OPAC and test the language selector menus in the header and
  footer.
  - The expanded menu in the header should extend to the left of the
    "Languages" menu trigger.
  - The expanded menu in the footer should extend to the right of the
    "Languages" menu trigger.

Signed-off-by: David Nind <david@davidnind.com>
---
 koha-tmpl/opac-tmpl/bootstrap/en/includes/langmenu.inc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/langmenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/langmenu.inc
index d4ed17a752..de4c8996bb 100644
--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/langmenu.inc
+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/langmenu.inc
@@ -8,7 +8,11 @@
                 <li class="nav-item dropdown">
             [% END %]
               <a href="#" title="Switch languages" class="nav-link dropdown-toggle" id="langmenu" data-bs-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-flag fa-fw fa-icon-[% context | html %]" aria-hidden="true"></i> <span class="langlabel">Languages</span> <b class="caret"></b></a>
-                <div aria-labelledby="langmenu" role="menu" class="dropdown-menu dropdown-menu-end">
+                [% IF ( context == "footer" ) -%]
+                    <div aria-labelledby="langmenu" role="menu" class="dropdown-menu">
+                [% ELSE -%]
+                    <div aria-labelledby="langmenu" role="menu" class="dropdown-menu dropdown-menu-end">
+                [% END %]
                     [% FOREACH languages_loo IN languages_loop %]
                         [% IF ( languages_loo.group_enabled ) %]
                             [% IF ( languages_loo.plural ) %]
-- 
2.39.2