Browse Source

fixing bug 1754: Hide language chooser if only one translation is available

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
3.0.x
Joshua Ferraro 15 years ago
parent
commit
2b28689ae8
  1. 3
      C4/Languages.pm
  2. 2
      changelanguage.pl
  3. 6
      koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc
  4. 2
      koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc

3
C4/Languages.pm

@ -254,6 +254,8 @@ sub _build_languages_arrayref {
my @translated_languages = @$translated_languages;
my @languages_loop; # the final reference to an array of hashrefs
my @enabled_languages = @$enabled_languages;
# how many languages are enabled, if one, take note, some contexts won't need to display it
my $one_language_enabled = 1 unless @enabled_languages > 1;
my %seen_languages; # the language tags we've seen
my %found_languages;
my $language_groups;
@ -298,6 +300,7 @@ sub _build_languages_arrayref {
plural => $track_language_groups->{$key} >1 ? 1 : 0,
current => $current_language_regex->{language} eq $key ? 1 : 0,
group_enabled => $enabled,
one_language_enabled => $one_language_enabled,
};
}
return \@languages_loop;

2
changelanguage.pl

@ -22,5 +22,5 @@ my $query = new CGI;
my $language = $query->param('language');
my $url = $query->referer();
warn "Language : $query // $language // $url";
#warn "Language : $query // $language // $url";
setlanguagecookie( $query, $language, $url );

6
koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc

@ -21,14 +21,16 @@
</ul></div></div></li>
<!-- TMPL_ELSE -->
<!-- TMPL_UNLESS NAME="one_language_enabled" -->
<!-- TMPL_IF NAME="group_enabled" -->
<!-- TMPL_IF NAME="current" -->
<li><!-- TMPL_VAR NAME="native_description" -->(<!-- TMPL_VAR NAME="rfc4646_subtag" -->)</li>
<li><!-- TMPL_IF NAME="native_description" --><!-- TMPL_VAR NAME="native_description" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="rfc4646_subtag" --><!-- /TMPL_IF --></li>
<!-- TMPL_ELSE -->
<li><a href="/cgi-bin/koha/changelanguage.pl?language=<!-- TMPL_VAR NAME="rfc4646_subtag" -->"><!-- TMPL_VAR NAME="native_description" --> (<!-- TMPL_VAR NAME="rfc4646_subtag" -->)</a></li>
<li><a href="/cgi-bin/koha/changelanguage.pl?language=<!-- TMPL_VAR NAME="rfc4646_subtag" -->"><!-- TMPL_IF NAME="native_description" --><!-- TMPL_VAR NAME="native_description" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="rfc4646_subtag" --><!-- /TMPL_IF --></a></li>
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</ul>

2
koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc

@ -24,6 +24,7 @@
</ul></div></div></li>
<!-- TMPL_ELSE -->
<!-- TMPL_UNLESS NAME="one_language_enabled" -->
<!-- TMPL_IF NAME="group_enabled" -->
<!-- TMPL_IF NAME="current" -->
<li><!-- TMPL_IF NAME="native_description" --><!-- TMPL_VAR NAME="native_description" --><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="rfc4646_subtag" --><!-- /TMPL_IF --></li>
@ -32,6 +33,7 @@
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</ul>

Loading…
Cancel
Save