Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bseddon

    (@bseddon)

    Answering my own question. It would be great if you can add a call to wp_localize_script in the plugin’s init function so the translated ‘translate’ can appear in the page to be used in load-toolbar.js:

    wp_localize_script("glt", 'glt_vars', array(
      'translate_text' => apply_filter('glt_translate', 'Translate')
    ));

    Then in the JavaScript the translated text to use can be applied:

    $('#glt-translate-trigger span').text(glt_vars.translate_text + ' ? ');

    And the same for the other trigger.

    Thread Starter bseddon

    (@bseddon)

    OK, that wp_localize_script was a bad example. Here’s how it should be and in the flags() function:

    wp_localize_script("flags", 'glt_vars', array(
      'translate_text' => apply_filters('glt_translate', 'Translate')
    ));
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Translating translate’ is closed to new replies.