Commit: a13561a9040a05636771b93924a19ba0d08ec6cf Author: Christoph M. Becker <cmbecke...@gmx.de> Mon, 30 Nov 2020 19:53:07 +0100 Parents: a5872f020fb5e739e7bf3d402fccb54b525fc37c Branches: master
Link: http://git.php.net/?p=web/php.git;a=commitdiff;h=a13561a9040a05636771b93924a19ba0d08ec6cf Log: Use own language selection for PHP 8 release page The general language selection capability of php.net is nice, but it does not allow to have translations of the PHP 8 release page which do not have active doc translations. To circumvent this limitation, we use an own super simple language selection capability for the PHP 8 release page. We do not even bother to support non JS enabled clients, since that was not supported before, although it could be done. Closes GH-375. Changed paths: M releases/8.0/common.php Diff: diff --git a/releases/8.0/common.php b/releases/8.0/common.php index d44f59e5c..748f76263 100644 --- a/releases/8.0/common.php +++ b/releases/8.0/common.php @@ -4,25 +4,7 @@ namespace releases\php80; include_once __DIR__ . '/../../include/prepend.inc'; function language_redirect(string $currentLang): void { - global $LANG; - - // At the time of writing, $LANG is safely ^\w{2}(-\w{2})?$ - // However, since it may be user-sourced, - // be extra careful about how we use it. - $baseLANG = basename($LANG); - $urlLANG = urlencode($LANG); - - if ($LANG === $currentLang) { - // We're on the right page for our language. Stay here. - return; - } - - if (file_exists(__DIR__ . "/$baseLANG.php")) { - \mirror_redirect("/releases/8.0/$urlLANG.php?lang=$urlLANG"); - exit; - } - - // We don't have a translation as requested, + // We don't use the general language selection of php.net, // so soldier on with this one. return; } @@ -73,7 +55,7 @@ function language_chooser(string $currentLang): void { <form action="" method="get" id="changelang" name="changelang"> <fieldset> <label for="changelang-langs">Change language:</label> - <select onchange="document.changelang.submit()" name="lang" id="changelang-langs"> + <select onchange="location = this.value + \'.php\'" name="lang" id="changelang-langs"> '; $tab = ' '; -- PHP Webmaster List Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php