[Koha-bugs] [Bug 7445] Clicking on a tag gives "Language ... does not exist"

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue Jan 17 21:34:56 CET 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7445

--- Comment #3 from Magnus Enger <magnus at enger.priv.no> 2012-01-17 20:34:56 UTC ---
In 3.4.6 it works for Swedish, regardless of what QueryStemming is set to, but
not for Norwegian. There's a difference between 3.4.6 and current master:

In 3.4.6 $lang is taken from C4::Templates::getlanguagecookie: 

389 sub getlanguagecookie {
390     my ($query) = @_;
391     my $lang;
392     if ($query->cookie('KohaOpacLanguage')){
393         $lang = $query->cookie('KohaOpacLanguage') ;
394     }else{
395         $lang = $ENV{HTTP_ACCEPT_LANGUAGE};
396         
397     }
398     $lang = substr($lang, 0, 2);
399 
400     return $lang;
401 }

In current master it comes from C4::Templates::getlanguage: 

311 sub getlanguage {
312     my ($query, $interface) = @_;
313 
314     # Select a language based on cookie, syspref available languages &
browser
315     my $is_intranet = $interface eq 'intranet';
316     my @languages = split(",", C4::Context->preference(
317         $is_intranet ? 'language' : 'opaclanguages'));
318 
319     my $lang;
320 
321     # cookie
322     if ( $query->cookie('KohaOpacLanguage') ) {
323         $lang = $query->cookie('KohaOpacLanguage');
324         $lang =~ s/[^a-zA-Z_-]*//; # sanitize cookie
325     }
326 
327     # HTTP_ACCEPT_LANGUAGE
328     unless ($lang) {
329         my $http_accept_language = $ENV{ HTTP_ACCEPT_LANGUAGE };
330         $lang = accept_language( $http_accept_language,
331             getTranslatedLanguages($interface,'prog') );
332     }
333 
334     # Ignore a lang not selected in sysprefs
335     $lang = undef  unless first { $_ eq $lang } @languages;
336 
337     # Fall back to English if necessary
338     $lang = 'en' unless $lang;
339 
340     return $lang;
341 }

In 3.4.6 "sv-SE" is reduced to "sv" on line 398 and this is a valid language
for Lingua::Stem::Snowball. "nb-NO" is reduced to "nb", which is not valid in
the eyes of Lingua::Stem::Snowball. C4::Templates::getlanguage returns the
unreduced strings, neither of which is valid for Lingua::Stem::Snowball.

-- 
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the Koha-bugs mailing list