Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_available_languages [ WordPress Function ]

get_available_languages ( $dir = null )
Parameters:
  • (string) $dir A directory in which to search for language files. The default directory is WP_LANG_DIR.
Returns:
  • (array) Array of language codes or an empty array if no languages are present. Language codes are formed by stripping the .mo extension from the language file names.
Defined at:



Get all available languages based on the presence of *.mo files in a given directory. The default directory is WP_LANG_DIR.

Source


<?php
function get_available_languages$dir null ) {
    
$languages = array();

    foreach( (array)
glob( ( is_null$dir) ? WP_LANG_DIR $dir ) . '/*.mo' ) as $lang_file ) {
        
$lang_file basename($lang_file'.mo');
        if ( 
!== strpos$lang_file'continents-cities' ) && !== strpos$lang_file'ms-' ) &&
            
!== strpos$lang_file'admin-' ))
            
$languages[] = $lang_file;
    }

    return 
$languages;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics