Making WordPress.org


Ignore:
Timestamp:
02/24/2019 11:13:53 PM (8 years ago)
Author:
ocean90
Message:

Plugin Directory: To get a translation set ID, split the locale into locale and locale slug to support locale variants.

See #4206.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-i18n.php

    r7899 r8341  
    224224                }
    225225
     226                // The slug is optional, use 'default' as .. default.
     227                list( $locale, $locale_slug ) = array_merge( explode( '/', $locale ), [ 'default' ] );
     228
    226229                $translation_set_id = $wpdb->get_var( $wpdb->prepare(
    227                         'SELECT id FROM ' . GLOTPRESS_TABLE_PREFIX . 'translation_sets WHERE project_id = %d AND locale = %s AND slug = "default"',
    228                         $branch_id, $locale
     230                        'SELECT id FROM ' . GLOTPRESS_TABLE_PREFIX . 'translation_sets WHERE project_id = %d AND locale = %s AND slug = %s',
     231                        $branch_id,
     232                        $locale,
     233                        $locale_slug
    229234                ) );
    230235
Note: See TracChangeset for help on using the changeset viewer.