commit b90c065d630276688f55b97ca26ab513b63aa58f Author: hiromipaw hiro@torproject.org Date: Thu Nov 16 21:03:12 2017 +0100
Move language switch to the top --- include/dlhead.wmi | 39 +++++++++++++++++++++++++++++++++++- include/foot.wmi | 52 +----------------------------------------------- include/perl-globals.wmi | 2 +- 3 files changed, 40 insertions(+), 53 deletions(-)
diff --git a/include/dlhead.wmi b/include/dlhead.wmi index 15c35317..59794458 100644 --- a/include/dlhead.wmi +++ b/include/dlhead.wmi @@ -114,7 +114,44 @@ docdir: $(DOCROOT)/; dir: $dir; base: $base -> $(DOCROOT)/$dir/$lang/$base.wml), } } }:> - </ul> + # LANGUAGE SWITCH CGI + <li> + # this is a cgi trampoline to bounce us to the right page + # alternately, if the client supports javascript we can redirect that way + # noscript does not block onclick but clients may have disabled javascript completely + # + # for this to work we need to know the relative path from the document root + # to the current directory that wml is in. + <form action="$(DOCROOT)/cgi-bin/languageswitch.cgi"> + <select name="Language" id="lang"> + <:{ + #import "perl-globals.wmi"; + use Cwd; + use Cwd 'abs_path'; + use File::Spec; + my $urlbase = File::Spec->abs2rel(getcwd(),abs_path("$(DOCROOT)")); + my $LANGUAGES; + my $page = $WML_SRC_FILENAME; + opendir(DIR, getcwd()) or die $!; + # take a look and see what language support we have + while (my $file = readdir(DIR)) { + if (-d $file) { + if (-e "$file/$page") { + my $url = $urlbase.'/'.$WML_SRC_BASENAME.'.html.'.$file; + my $url2js = $WML_SRC_BASENAME.'.html.'.$file; + print '<option value="'.$url.'" onclick="window.location=\''.$url2js.'\'">'.$LANGUAGES{$file}.'</option>'."\n" unless not defined $LANGUAGES{$file}; + } + } + } + closedir(DIR); + }:> + </select> + <input class="go" type="submit" name="submit" value="Go"> + </form> + </li> + # + </ul> + </div> <!-- END NAV --> # end navigation generation diff --git a/include/foot.wmi b/include/foot.wmi index 12f30cea..85116848 100644 --- a/include/foot.wmi +++ b/include/foot.wmi @@ -65,57 +65,7 @@ </div> <!-- END COL -->
- <!-- List available languages --> - <div class="col wider"> - <h4>Languages</h4> - <: if (has_translations()) { :> - <p> - This page is also available in the following languages: - <: print list_translations() :>.<br /> - How to set <a href="http://www.debian.org/intro/cn#howtoset">the default document language</a>. - </p> - <: }; :> - </div> - -# LANGUAGE SWITCH CGI - <div class="col wider"> - <h4>Languages</h4> - # this is a cgi trampoline to bounce us to the right page - # alternately, if the client supports javascript we can redirect that way - # noscript does not block onclick but clients may have disabled javascript completely - # - # for this to work we need to know the relative path from the document root - # to the current directory that wml is in. - <form action="$(DOCROOT)/cgi-bin/languageswitch.cgi"> - <select name="Language" id="lang"> - <:{ - #import "perl-globals.wmi"; - use Cwd; - use Cwd 'abs_path'; - use File::Spec; - my $urlbase = File::Spec->abs2rel(getcwd(),abs_path("$(DOCROOT)")); - my $LANGUAGES; - my $page = $WML_SRC_FILENAME; - opendir(DIR, getcwd()) or die $!; - # take a look and see what language support we have - while (my $file = readdir(DIR)) { - if (-d $file) { - if (-e "$file/$page") { - my $url = $urlbase.'/'.$WML_SRC_BASENAME.'.html.'.$file; - my $url2js = $WML_SRC_BASENAME.'.html.'.$file; - print '<option value="'.$url.'" onclick="window.location=\''.$url2js.'\'">'.$LANGUAGES{$file}.'</option>'."\n" unless not defined $LANGUAGES{$file}; - } - } - } - closedir(DIR); - }:> - </select> - <input class="go" type="submit" name="submit" value="Go"> - </form> - <p>Questions on this? Visit <a href="http://www.debian.org/intro/cn#howtoset">how to set the default document language</a>.</p> - </div> -# - </div> +</div> <!-- END FOOTER -->
</div> diff --git a/include/perl-globals.wmi b/include/perl-globals.wmi index b639483d..7a5fd76b 100644 --- a/include/perl-globals.wmi +++ b/include/perl-globals.wmi @@ -10,7 +10,7 @@ 'da' => "Danish", 'de' => "Deutsch", 'en' => "English", - 'es' => "español", + 'es' => "Español", 'et' => "Estonian", 'fa' => "فارسی (Fārsī)", 'fi' => "suomi",
tor-commits@lists.torproject.org