Permalink
Browse files

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

…ilable

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
  • Loading branch information...
1 parent 3b16acf commit 2b28689ae8aa0de4e9b24dfd9c489ad9f6d7e4a6 Joshua Ferraro committed Mar 18, 2008
View
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;
View
2 changelanguage.pl
@@ -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 );
View
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>
View
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>

0 comments on commit 2b28689

Please sign in to comment.