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

How to debug failed load_theme_textdomain()?

load_theme_textdomain() returns TRUE on success and FALSE if no file was found. For debugging try the following change: function my_theme_setup(){ $path = get_template_directory() . ‘/languages’; $result = load_theme_textdomain(‘my_theme’, $path ); if ( $result ) return; $locale = apply_filters( ‘theme_locale’, get_locale(), ‘my_theme’ ); die( “Could not find $path/$locale.mo.” ); }

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

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

Filter translations (gettext strings) on specific admin pages

According with the codex, get_current_screen() has to be used later than admin_init hook. After a few tests, it seems that the safiest way is to use current_screen action hook instead of get_current_screen(): add_action(‘current_screen’, ‘current_screen_callback’); function current_screen_callback($screen) { if( is_object($screen) && $screen->post_type == ‘mycpt’ ) { add_filter( ‘gettext’, ‘theme_change_comments_label’, 99, 3 ); } } function theme_change_comments_label( … Read more

How can I manually upgrade translations?

quick-and-dirty hint to solve this problem: find the function list_translation_updates() in wp-admin/update-core.php $updates = wp_get_translation_updates(); if ( ! $updates ) <- locate the if … } else { <- add this print_r ( $updates ); } add the else-case and save the file reload the dashboard page and you will get the desired information.

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