コード例 #1
0
ファイル: loco-boot.php プロジェクト: josejoaosantos/wp-loco
 /**
  * Bootstrap localisation of self
  */
 public static function load_textdomain($locale = null)
 {
     if (is_null($locale)) {
         $locale = get_locale();
     }
     if (!$locale || 0 === strpos($locale, 'en')) {
         self::$locale and unload_textdomain(Loco::NS);
         $locale = 'en_US';
     } else {
         if (self::$locale !== $locale) {
             $plugin_rel_path = basename(self::basedir());
             load_plugin_textdomain(Loco::NS, false, $plugin_rel_path . '/languages');
         }
     }
     // detect changes in plugin locale, binding once only
     isset(self::$locale) or add_filter('plugin_locale', array(__CLASS__, 'filter_plugin_locale'), 10, 2);
     self::$locale = $locale;
 }