Changeset 6507
- Timestamp:
- 06/09/2017 02:46:51 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bbpress.php
r6498 r6507 213 213 $this->file = __FILE__; 214 214 $this->basename = apply_filters( 'bbp_plugin_basename', str_replace( array( 'build/', 'src/' ), '', plugin_basename( $this->file ) ) ); 215 $this->base_dir = apply_filters( 'bbp_plugin_base_dir', trailingslashit( dirname( $this->basename ) ) ); 215 216 216 217 // Path and URL … … 223 224 224 225 // Languages 226 $this->lang_base = apply_filters( 'bbp_lang_base', trailingslashit( $this->base_dir . 'languages' ) ); 225 227 $this->lang_dir = apply_filters( 'bbp_lang_dir', trailingslashit( $this->plugin_dir . 'languages' ) ); 226 228 … … 486 488 public function load_textdomain() { 487 489 488 // Traditional WordPress plugin locale filter 489 $locale = apply_filters( 'plugin_locale', get_locale(), $this->domain ); 490 $mofile = sprintf( '%1$s-%2$s.mo', $this->domain, $locale ); 491 492 // Setup paths to current locale file 493 $mofile_local = $this->lang_dir . $mofile; 494 $mofile_global = WP_LANG_DIR . '/bbpress/' . $mofile; 495 496 // Look in global /wp-content/languages/bbpress folder 497 load_textdomain( $this->domain, $mofile_global ); 498 499 // Look in local /wp-content/plugins/bbpress/languages/ folder 500 load_textdomain( $this->domain, $mofile_local ); 490 // Define the old directory 491 $old_dir = WP_LANG_DIR . '/bbpress/'; 492 493 // Old location, deprecated in 2.6.0 494 if ( is_dir( $old_dir ) ) { 495 496 // Get locale & file-name 497 $type = is_admin() ? get_user_locale() : get_locale(); 498 $locale = apply_filters( 'plugin_locale', $type, $this->domain ); 499 $mofile = sprintf( '%1$s-%2$s.mo', $this->domain, $locale ); 500 501 // Look in global /wp-content/languages/bbpress/ folder 502 load_textdomain( $this->domain, $old_dir . $mofile ); 503 } 501 504 502 505 // Look in global /wp-content/languages/plugins/ 503 load_plugin_textdomain( $this->domain );506 load_plugin_textdomain( $this->domain, false, $this->lang_base ); 504 507 } 505 508
Note: See TracChangeset
for help on using the changeset viewer.