Changeset 25652 for trunk/src/wp-includes/l10n.php
- Timestamp:
- 09/30/2013 07:46:15 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/l10n.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/l10n.php
r25586 r25652 746 746 * @since 3.7.0 747 747 * 748 * @param string $type What to search for. Accepts 'plugins', 'themes' .748 * @param string $type What to search for. Accepts 'plugins', 'themes', 'core'. 749 749 * @return array Array of language data. 750 750 */ 751 751 function wp_get_installed_translations( $type ) { 752 if ( $type !== 'themes' && $type !== 'plugins' )752 if ( $type !== 'themes' && $type !== 'plugins' && $type !== 'core' ) 753 753 return array(); 754 754 755 if ( ! is_dir( WP_LANG_DIR ) || ! is_dir( WP_LANG_DIR . "/$type" ) ) 755 $dir = 'core' === $type ? '' : "/$type"; 756 757 if ( ! is_dir( WP_LANG_DIR ) ) 756 758 return array(); 757 759 758 $files = scandir( WP_LANG_DIR . "/$type" ); 760 if ( $dir && ! is_dir( WP_LANG_DIR . $dir ) ) 761 return array(); 762 763 $files = scandir( WP_LANG_DIR . $dir ); 759 764 if ( ! $files ) 760 765 return array(); … … 767 772 if ( substr( $file, -3 ) !== '.po' ) 768 773 continue; 769 if ( ! preg_match( '/( .*)-([A-Za-z_]{2,6}).po/', $file, $match ) )774 if ( ! preg_match( '/(?:(.+)-)?([A-Za-z_]{2,6}).po/', $file, $match ) ) 770 775 continue; 771 776 772 777 list( , $textdomain, $language ) = $match; 773 $language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "/$type/$file" ); 778 if ( '' === $textdomain ) 779 $textdomain = 'default'; 780 $language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "$dir/$file" ); 774 781 } 775 782 return $language_data;
Note: See TracChangeset
for help on using the changeset viewer.