Changeset 1925 for sites/trunk/wordpress.org/public_html/wp-content/plugins/glotpress-translate-bridge/glotpress-translate-bridge.php
- Timestamp:
- 09/30/2015 02:08:58 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/glotpress-translate-bridge/glotpress-translate-bridge.php
r1793 r1925 138 138 LEFT JOIN {$this->gp_prefix}translations t ON t.original_id = o.id AND t.translation_set_id = s.id 139 139 140 WHERE 140 WHERE 141 141 $sql_project AND $sql_singular AND $sql_plural AND $sql_context AND $sql_locale 142 142 AND o.status = '+active' … … 161 161 * Determines the GlotPress Locale for a given WordPress Locale 162 162 * 163 * This makes assumptions about the format of a GlotPress slug, which may not reflect real-world use-cases. 163 * Uses `GP_Locales` if 'GLOTPRESS_LOCALES_PATH' is defined. Otherwise it makes assumptions about the format of a GlotPress slug, 164 * which may not reflect real-world use-cases. 164 165 * 165 166 * @access private … … 168 169 */ 169 170 private function glotpress_locale() { 170 $ gp_locale = strtolower( get_locale());171 172 if ( 'en_ us' === $gp_locale ) {171 $wp_locale = get_locale(); 172 173 if ( 'en_US' === $wp_locale ) { 173 174 return false; 174 175 } 175 176 176 preg_match( '!^([a-z]{2,3})(_([a-z]{2}))?(_([a-z0-9]+))?$!', $gp_locale, $matches ); 177 177 preg_match( '!^([a-z]{2,3})(_([A-Z]{2}))?(_([a-z0-9]+))?$!', $wp_locale, $matches ); 178 179 $wp_locale = $matches[1] . $matches[2]; 178 180 $locale = $matches[1]; 179 181 $country = isset( $matches[3] ) ? $matches[3] : $matches[1]; 180 182 $variant = isset( $matches[5] ) ? $matches[5] : false; 181 182 if ( $locale !== $country ) { 183 $locale .= '-' . $country; 183 184 if ( defined( 'GLOTPRESS_LOCALES_PATH' ) ) { 185 require_once( GLOTPRESS_LOCALES_PATH ); 186 187 $gp_locale = GP_Locales::by_field( 'wp_locale', $wp_locale ); 188 if ( $gp_locale ) { 189 $locale = $gp_locale->slug; 190 } 191 } else { 192 $country = strtolower( $country ); 193 if ( $locale !== $country ) { 194 $locale .= '-' . $country; 195 } 184 196 } 185 197
Note: See TracChangeset
for help on using the changeset viewer.