Plugin Directory

Changeset 2607383


Ignore:
Timestamp:
09/30/2021 04:29:55 PM (4 years ago)
Author:
teplosup
Message:

Improve translate

File:
1 edited

Legend:

Unmodified
Added
Removed
  • shmapper-by-teplitsa/trunk/shmapper.php

    r2607205 r2607383  
    6363
    6464/** Load textdomain */
    65 function shm_load_plugin_textdomain() {
    66     load_plugin_textdomain( 'shmapper-by-teplitsa', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
     65function shm_load_textdomain_mofile( $mofile, $domain ) {
     66    if ( 'shmapper-by-teplitsa' === $domain ) {
     67        $locale = apply_filters( 'plugin_locale', determine_locale(), $domain );
     68        if ( 'de_DE' === $locale ) {
     69            $mofile = WP_PLUGIN_DIR . '/' . dirname( plugin_basename( __FILE__ ) ) . '/languages/' . $domain . '-' . $locale . '.mo';
     70        }
     71    }
     72    return $mofile;
    6773}
    68 add_action( 'plugins_loaded', 'shm_load_plugin_textdomain' );
     74add_filter( 'load_textdomain_mofile', 'shm_load_textdomain_mofile', 10, 2 );
    6975
    7076require_once SHM_REAL_PATH . 'inc/shm-functions.php';
Note: See TracChangeset for help on using the changeset viewer.