関数 wp_get_installed_translations()
2015/01/10
関数 wp_get_installed_translations()
定義ファイル :/blog/wp-includes/l10n.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | function wp_get_installed_translations( $type ) { if ( $type !== 'themes' && $type !== 'plugins' && $type !== 'core' ) return array(); $dir = 'core' === $type ? '' : "/$type"; if ( ! is_dir( WP_LANG_DIR ) ) return array(); if ( $dir && ! is_dir( WP_LANG_DIR . $dir ) ) return array(); $files = scandir( WP_LANG_DIR . $dir ); if ( ! $files ) return array(); $language_data = array(); foreach ( $files as $file ) { if ( '.' === $file[0] || is_dir( $file ) ) continue; if ( substr( $file, -3 ) !== '.po' ) continue; if ( ! preg_match( '/(?:(.+)-)?([A-Za-z_]{2,6}).po/', $file, $match ) ) continue; list( , $textdomain, $language ) = $match; if ( '' === $textdomain ) $textdomain = 'default'; $language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "$dir/$file" ); } return $language_data; } |