WPSEO_Help_Center::get_translated_texts PHP Method

get_translated_texts() public static method

%s is replaced with %s and replaced again in the javascript with the actual variable.
public static get_translated_texts ( ) : array
return array Translated text strings for the help center.
    public static function get_translated_texts()
    {
        return array('variable_warning' => sprintf(__('Warning: the variable %s cannot be used in this template. See the help center for more info.', 'wordpress-seo'), '<code>%s</code>'), 'locale' => get_locale(), 'kb_found_results' => __('Number of search results: %d', 'wordpress-seo'), 'kb_no_results' => __('No results found.', 'wordpress-seo'), 'kb_heading' => __('Search the Yoast knowledge base', 'wordpress-seo'), 'kb_search_button_text' => __('Search', 'wordpress-seo'), 'kb_search_results_heading' => __('Search results', 'wordpress-seo'), 'kb_error_message' => __('Something went wrong. Please try again later.', 'wordpress-seo'), 'kb_loading_placeholder' => __('Loading...', 'wordpress-seo'), 'kb_search' => __('search', 'wordpress-seo'), 'kb_back' => __('Back', 'wordpress-seo'), 'kb_back_label' => __('Back to search results', 'wordpress-seo'), 'kb_open' => __('Open', 'wordpress-seo'), 'kb_open_label' => __('Open the knowledge base article in a new window or read it in the iframe below', 'wordpress-seo'), 'kb_iframe_title' => __('Knowledge base article', 'wordpress-seo'));
    }

Usage Example

Esempio n. 1
0
 /**
  * Loads the required scripts for the config page.
  */
 function config_page_scripts()
 {
     $this->asset_manager->enqueue_script('admin-script');
     wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-script', 'wpseoAdminL10n', WPSEO_Help_Center::get_translated_texts());
     wp_enqueue_script('dashboard');
     wp_enqueue_script('thickbox');
     $page = filter_input(INPUT_GET, 'page');
     wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-script', 'wpseoSelect2Locale', WPSEO_Utils::get_language(get_locale()));
     if (in_array($page, array('wpseo_social', WPSEO_Admin::PAGE_IDENTIFIER))) {
         wp_enqueue_media();
         $this->asset_manager->enqueue_script('admin-media');
         wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', $this->localize_media_script());
     }
     if ('wpseo_tools' === $page) {
         $this->enqueue_tools_scripts();
     }
 }
All Usage Examples Of WPSEO_Help_Center::get_translated_texts