• Resolved Joms

    (@jomsky)


    It seems that the plugin makes the language file inside the plugin directory (plugins/wc-frontend-manager/lang) a priority rather than the one on wp-content/languages/plugins.

    This is a problem when we want to use our own translation file outside the plugin directory.

    In your plugin there’s a call to the function load_textdomain twice so the first translation will override the second one. Not sure why you didn’t use a single load_plugin_textdomain() instead?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author WC Lovers

    (@wclovers)

    Hi,

    Here is WCFM localization load code – https://ibb.co/JFZj1fp

    We have prioritize “wp-content/languages/plugins” over “plugins/wc-frontend-manager/lang”.

    And it works perfectly for all translation plugins (Loco Translate etc …)

    Please be sure with your “.mo” file it’s properly named.

    Thank You

    Thread Starter Joms

    (@jomsky)

    Thanks, the way it works though is that the first language file that’s loaded will override the succeeding ones. It’s also right there in the top comment of your method 🙂

    That’s why I suggested load_plugin_textdomain since it has a builtin logic to check the languages directory first –

    
        // Try to load from the languages directory first.
        if ( load_textdomain( $domain, WP_LANG_DIR . '/plugins/' . $mofile ) ) {
            return true;
        }
     
        if ( false !== $plugin_rel_path ) {
            $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' );
        } elseif ( false !== $deprecated ) {
            _deprecated_argument( __FUNCTION__, '2.7.0' );
            $path = ABSPATH . trim( $deprecated, '/' );
        } else {
            $path = WP_PLUGIN_DIR;
        }
     

    Cheers

    Plugin Author WC Lovers

    (@wclovers)

    Thanks for the suggestion, we will definitely look into this 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Localization issue’ is closed to new replies.