WordPress.org

Make WordPress Core


Ignore:
Timestamp:
10/08/2014 07:04:05 PM (5 years ago)
Author:
ocean90
Message:

Language packs: Remove translations when deleting a theme or a plugin.

This is for translation files in WP_LANG_DIR which are installed through a language pack.
Change wp_get_installed_translations() to only return a translation if the .mo file also exists.

fixes #29860.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/l10n.php

    r29630 r29856  
    798798
    799799    foreach ( $files as $file ) {
    800         if ( '.' === $file[0] || is_dir( $file ) )
     800        if ( '.' === $file[0] || is_dir( $file ) ) {
    801801            continue;
    802         if ( substr( $file, -3 ) !== '.po' )
     802        }
     803        if ( substr( $file, -3 ) !== '.po' ) {
    803804            continue;
    804         if ( ! preg_match( '/(?:(.+)-)?([A-Za-z_]{2,6}).po/', $file, $match ) )
     805        }
     806        if ( ! preg_match( '/(?:(.+)-)?([A-Za-z_]{2,6}).po/', $file, $match ) ) {
    805807            continue;
     808        }
     809        if ( ! in_array( substr( $file, 0, -3 ) . '.mo', $files ) )  {
     810            continue;
     811        }
    806812
    807813        list( , $textdomain, $language ) = $match;
    808         if ( '' === $textdomain )
     814        if ( '' === $textdomain ) {
    809815            $textdomain = 'default';
     816        }
    810817        $language_data[ $textdomain ][ $language ] = wp_get_pomo_file_data( WP_LANG_DIR . "$dir/$file" );
    811818    }
Note: See TracChangeset for help on using the changeset viewer.