How to provide translations for a WordPress TinyMCE plugin?

Use the filter ‘mce_external_languages’. From wp-includes/class-wp-editor.php: The following filter loads external language files for TinyMCE plugins. It takes an associative array ‘plugin_name’ => ‘path’, where path is the include path to the file. The language file should follow the same format as /tinymce/langs/wp-langs.php and should define a variable $strings that holds all translated strings. When … Read more

gettext does not translate when called in ajax

it is too late but for public use: /* if qTranslate is installed */ /* set front locale for ajax calls requested from front-end */ function set_locale_for_frontend_ajax_calls() { if ( is_admin() && defined( ‘DOING_AJAX’ ) && DOING_AJAX && substr( $_SERVER[‘HTTP_REFERER’], 0, strlen( admin_url() ) ) != admin_url() ) { load_theme_textdomain( ‘your-theme-domain-name’, get_template_directory() . ‘/languages’ ); … Read more

Text Domains Across Multiple Plugins & Themes

You don’t. Translations are part of each item’s commit history, they should be kept as separate as the PHP code. In terms of performance, you don’t win much with a combined text domain. Actually, you could lose performance, because if you need that one translation array almost everywhere, you cannot load it selectively anymore or … Read more

Localized WordPress is much slower?

For each translation file, WordPress has to unpack it, then each entry will be converted into an Translation_Entry object. The short string “caller_get_posts” is deprecated. Use “ignore_sticky_posts” instead. will need three times more memory when it is translated: ‘”caller_get_posts” is deprecated. Use “ignore_sticky_posts” instead.’ => Translation_Entry::__set_state(array( ‘is_plural’ => false, ‘context’ => NULL, ‘singular’ => ‘”caller_get_posts” … Read more

How to integrate get_post_time with date_i18n function?

Use the fourth parameter for get_post_time(): $time = get_post_time( ‘F j, Y’, // format TRUE, // GMT get_the_ID(), // Post ID TRUE // translate, use date_i18n() ); get_post_time() calls mysql2date() internally, and it passes the $translate argument through. In mysql2date() we find this: if ( $translate ) return date_i18n( $format, $i ); So, all you … Read more

Enqueue Stylesheets After Theme’s “rtl.css”

Stylesheet Printing Order WordPress does not load themes’ alternative rtl.css files using wp_register_style() or wp_enqueue_style(). As such, the stylesheet does not get added to WordPress’s style queue, and cannot be specified as a dependency when registering or enqueueing additional stylesheets. Instead, this stylesheet’s <link> element is added via the locale_stylesheet() function, which is attached to … Read more

Change locale manually at runtime?

I’m trying to do a similiar thing, and the experts on the wp-hackers mailing list (Otto, Nacin) told me this: Don’t try to change WPLANG, you can’t change a define’d constant. Instead, change the global $locale, or put a filter on ‘locale’. So the best solution is to apply a filter on the ‘locale’ global … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)