@@ -354,35 +354,26 @@ PAGE_TOOLS;
354
354
function manual_language_chooser ($currentlang, $currentpage) {
355
355
global $ACTIVE_ONLINE_LANGUAGES;
356
356
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
364
358
$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 = ' ' ;
376
365
}
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
+
379
371
$r = <<<CHANGE_LANG
380
372
<form action=" /manual/change.php" method=" get" id=" changelang" name=" changelang" >
381
373
<fieldset>
382
374
<label for =" changelang-langs" >Change language:</label>
383
375
<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}
386
377
</select>
387
378
</fieldset>
388
379
</form>
0 commit comments