• Resolved tento

    (@tento)


    Hi,
    has anyone had any success with Loco translate and Fitness calculators?
    It seems like the two don;t work together? (the translated overlay does not show)

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author gurcharan singh

    (@gurcharanphp)

    Can you please share the screenshot of the issue that would be great to understand and resolve one?

    Same issue here, the PO language files are not loaded. I tried adding the function below to theme’s functions.php, because the plugin is not calling “load_plugin_textdomain” still not working:

    function fitness_calculator_init() {
    $plugin_rel_path = basename( dirname( __FILE__ ) ) . ‘/languages’; /* Relative to WP_PLUGIN_DIR */
    load_plugin_textdomain( ‘fitness-calculators’, false, $plugin_rel_path );
    }
    add_action(‘plugins_loaded’, ‘fitness_calculator_init’);

    Loading the plugin translations should not be done during plugins_loaded action since that is too early. Calling load_plugin_textdomain() should be delayed until init action:

    add_action(‘init’, ‘fitness_calculators_init’);

    • This reply was modified 3 years, 8 months ago by ryancole. Reason: resolved
    • This reply was modified 3 years, 8 months ago by ryancole.

    Fixed! here is the correct working code below, changed the path to be added to theme functions.php:

    function fitness_calculators_init() {
    $plugin_rel_path = ‘/fitness-calculators/languages’;
    load_plugin_textdomain( ‘fitness-calculators’, false, $plugin_rel_path );
    }
    add_action(‘init’, ‘fitness_calculators_init’);

    • This reply was modified 3 years, 8 months ago by ryancole. Reason: resolved
    • This reply was modified 3 years, 8 months ago by ryancole.
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘LOCO Translae’ is closed to new replies.