Skip to content

Commit

Permalink
fixing bug 1754: Hide language chooser if only one translation is ava…
Browse files Browse the repository at this point in the history
…ilable

Signed-off-by: Joshua Ferraro <[email protected]>
  • Loading branch information
Joshua Ferraro committed Mar 18, 2008
1 parent 3b16acf commit 2b28689
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions C4/Languages.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion changelanguage.pl
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
my $language = $query->param('language');
my $url = $query->referer();

warn "Language : $query // $language // $url";
#warn "Language : $query // $language // $url";
setlanguagecookie( $query, $language, $url );
6 changes: 4 additions & 2 deletions koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 2 additions & 0 deletions koha-tmpl/opac-tmpl/prog/en/includes/opac-bottom.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -32,6 +33,7 @@
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_IF -->
<!-- /TMPL_UNLESS -->
<!-- /TMPL_IF -->
<!-- /TMPL_LOOP -->
</ul>
Expand Down

0 comments on commit 2b28689

Please sign in to comment.