wp_install_language_form

Output the select form for the language selection on the installation screen.

Description

wp_install_language_form( (array) $languages ); 

Parameters (1)

0. $languages (array)
Array of available languages (populated via the Translation API).

Usage

  1. if ( !function_exists( 'wp_install_language_form' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/translation-install.php'; 
  3.  
  4. // Array of available languages (populated via the Translation API). 
  5. $languages = array(); 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_install_language_form($languages); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/translation-install.php  
  1. function wp_install_language_form( $languages ) { 
  2. global $wp_local_package; 
  3.  
  4. $installed_languages = get_available_languages(); 
  5.  
  6. echo "<label class='screen-reader-text' for='language'>Select a default language</label>\n"; 
  7. echo "<select size='14' name='language' id='language'>\n"; 
  8. echo '<option value="" lang="en" selected="selected" data-continue="Continue" data-installed="1">English (United States)</option>'; 
  9. echo "\n"; 
  10.  
  11. if ( ! empty( $wp_local_package ) && isset( $languages[ $wp_local_package ] ) ) { 
  12. if ( isset( $languages[ $wp_local_package ] ) ) { 
  13. $language = $languages[ $wp_local_package ]; 
  14. printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",  
  15. esc_attr( $language['language'] ),  
  16. esc_attr( current( $language['iso'] ) ),  
  17. esc_attr( $language['strings']['continue'] ),  
  18. in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',  
  19. esc_html( $language['native_name'] ) ); 
  20.  
  21. unset( $languages[ $wp_local_package ] ); 
  22.  
  23. foreach ( $languages as $language ) { 
  24. printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",  
  25. esc_attr( $language['language'] ),  
  26. esc_attr( current( $language['iso'] ) ),  
  27. esc_attr( $language['strings']['continue'] ),  
  28. in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',  
  29. esc_html( $language['native_name'] ) ); 
  30. echo "</select>\n"; 
  31. echo '<p class="step"><span class="spinner"></span><input id="language-continue" type="submit" class="button button-primary button-large" value="Continue" /></p>';