@@ -354,35 +354,26 @@ PAGE_TOOLS;
354354function manual_language_chooser ($currentlang, $currentpage) {
355355 global $ACTIVE_ONLINE_LANGUAGES;
356356
357- $links = [];
358-
359- foreach ($ACTIVE_ONLINE_LANGUAGES as $lang => $name) {
360- $links[] = [" $lang/$currentpage" , $name, $lang];
361- }
362-
363- // Print out the form with all the options
357+ // Prepare the form with all the options
364358 $othersel = ' selected="selected"' ;
365- $format_options = function (array $links) use ($currentlang, &$othersel) {
366- $out = ' ' ;
367- $tab = str_repeat (' ' , 6 );
368- foreach ($links as $link) {
369- list ($value, $text, $lang) = $link;
370- $selected = ' ' ;
371- if ($lang == $currentlang) {
372- $selected = ' selected="selected"' ;
373- $othersel = ' ' ;
374- }
375- $out .= " $tab<option value='$value'$selected>$text</option>\n " ;
359+ $out = [];
360+ foreach ($ACTIVE_ONLINE_LANGUAGES as $lang => $text) {
361+ $selected = ' ' ;
362+ if ($lang == $currentlang) {
363+ $selected = ' selected="selected"' ;
364+ $othersel = ' ' ;
376365 }
377- return trim ($out);
378- };
366+ $out[] = " <option value='$lang/$currentpage'$selected>$text</option>" ;
367+ }
368+ $out[] = " <option value='help-translate.php'{$othersel}>Other</option>" ;
369+ $format_options = implode (" \n " . str_repeat (' ' , 6 ), $out);
370+
379371 $r = <<<CHANGE_LANG
380372 <form action=" /manual/change.php" method=" get" id=" changelang" name=" changelang" >
381373 <fieldset>
382374 <label for =" changelang-langs" >Change language:</label>
383375 <select onchange=" document.changelang.submit()" name=" page" id=" changelang-langs" >
384- {$format_options ($links)}
385- <option value=" help-translate.php" {$othersel}>Other</option>
376+ {$format_options}
386377 </select>
387378 </fieldset>
388379 </form>
0 commit comments