I would like to add a custom column that displays the word count for each translation job/task in the table. This would help our translators gauge the size of each task at a glance.
I've tried to find hooks or filters in the WPML documentation that would allow me to add this custom column, but I haven't had any luck so far. Could you guide me on how to achieve this? Is there a specific hook or method within WPML that I can use to add a custom column to the Translation Management table?
Additionally, I would like this custom column to calculate and display the word count for the original content that needs to be translated. Any guidance on this would be greatly appreciated.
Languages: English (English )German (Deutsch )French (Français )
Timezone: Europe/Zagreb (GMT+01:00)
Hi,
Thank you for contacting WPML support!
I'm afraid there isn't a way to achieve this nor officially supported hook. I was able to trace this down to wpml_tm_dashboard_word_count_estimation action within classes\words-count\hooks\wpml-tm-word-count-admin-hooks.php.
Perhaps you can try using this function like this:
function custom_wpml_word_count_estimation($word_count, $post_id, $lang_code) {
// Your custom word count estimation logic goes here
// $word_count is the default word count calculated by WPML
// $post_id is the post ID for which the word count is being estimated
// $lang_code is the language code for the target language
return $custom_word_count;
}
add_action('wpml_tm_dashboard_word_count_estimation', 'custom_wpml_word_count_estimation', 10, 3);
But then you would still need to somehow hook it into the location you are after. I'm afraid not this is officially supported or documented, you can perhaps check with our https://wpml.org/contractors/ to have this solution custom coded.