com web/php: selects "Other" in language chooser if current language should not be available (fixes #67629): include/shared-manual.inc

[email protected] (Maciej Sobaczewski)
Newsgroups php.webmaster
Message-ID <[email protected]>
Commit:    a9aafdff2e6276ad445d198978f9556fd78261bf
Author:    Christoph M. Becker <[email protected]>         Tue, 24 Mar 2015 19:43:30 +0100
Parents:   94b8ec7f3b75f080648585dfb6999128f3faf0da
Branches:  master

Link:       http://git.php.net/?p=web/php.git;a=commitdiff;h=a9aafdff2e6276ad445d198978f9556fd78261bf

Log:
selects "Other" in language chooser if current language should not be available (fixes #67629)

Bugs:
https://bugs.php.net/67629

Changed paths:
  M  include/shared-manual.inc


Diff:
diff --git a/include/shared-manual.inc b/include/shared-manual.inc
index 9d330f6..d693c25 100644
--- a/include/shared-manual.inc
+++ b/include/shared-manual.inc
@@ -464,7 +464,8 @@ function manual_language_chooser($currentlang, $currentpage) {
     }
 
     // Print out the form with all the options
-    $format_options = function (array $links) use ($currentlang) {
+    $othersel = ' selected="selected"';
+    $format_options = function (array $links) use ($currentlang, &$othersel) {
         $out = '';
         $tab = str_repeat('  ', 6);
         foreach ($links as $link) {
@@ -472,6 +473,7 @@ function manual_language_chooser($currentlang, $currentpage) {
             $selected = '';
             if ($lang == $currentlang) {
                 $selected = ' selected="selected"';
+                $othersel = '';
             }
             $out .= "$tab<option value='$value'$selected>$text</option>\n";
         }
@@ -483,7 +485,7 @@ function manual_language_chooser($currentlang, $currentpage) {
           <label for="changelang-langs">Change language:</label>
           <select onchange="document.changelang.submit()" name="page" id="changelang-langs">
             {$format_options($links)}
-            <option value="help-translate.php">Other</option>
+            <option value="help-translate.php"{$othersel}>Other</option>
           </select>
         </fieldset>
       </form>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.