Translation for a text that is not printed on the screen
How can I enable the translation for a text that is not printed on the screen? I was recently implementing the translation to my plugin and everything worked as expected. But doing the tests I realized that I was missing something. There is a small piece of code in my plugin that creates terms based on a condition, but one of them is a text and I need it to be translated. how can I do? I understand that __
and _e
are just for static strings that are printed to screen.
if ( empty ( $cookie ) ) {
wp_set_post_terms( $post_id, '- Default', 'directory' );
}
else {
wp_set_post_terms( $post_id, $cookie, 'directory' );
}
(- Default) is what I need to translate
Thanks to whoever can help me
Topic translation multi-language plugin-development plugins Wordpress
Category Web