From 25f8ba16c8825e42c3a154b61b3ee0b0b4a6ab10 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Mon, 21 Jan 2013 17:02:42 -0500 Subject: [PATCH] TPAC: Make locale picker match default locale As noted by Pasi Kallinen, the language picker would not reflect the chosen locale unless your cookie had been set or there was an explicit CGI parameter with the locale name. Accordingly, get the default locale from the context vars and use that to set the selected value for the language picker in the absence of anything else, to prevent the picker from possibly confusingly showing the first language alphabetically rather than the currently displayed language in the rest of the UI. Signed-off-by: Dan Scott Signed-off-by: Pasi Kallinen Signed-off-by: Ben Shum --- Open-ILS/src/templates/opac/parts/locale_picker.tt2 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/templates/opac/parts/locale_picker.tt2 b/Open-ILS/src/templates/opac/parts/locale_picker.tt2 index c81f1f134d..12019cdddd 100644 --- a/Open-ILS/src/templates/opac/parts/locale_picker.tt2 +++ b/Open-ILS/src/templates/opac/parts/locale_picker.tt2 @@ -1,5 +1,10 @@ [%- IF ctx.locales.keys.size > 1; - set_locale = CGI.param('set_eg_locale') || CGI.cookie('eg_locale'); + + # Ensure the context locale is in xx_yy format + base_locale = ctx.locale FILTER lower; + base_locale = base_locale.replace('-','_'); + + set_locale = CGI.param('set_eg_locale') || CGI.cookie('eg_locale') || base_locale; %]
-- 2.11.0