wordpress __() gettext problem


I am using WPML string translation to translate strings in my site. When I check the theme file the gettext functions are written without a second argument

eg: __('some text to translate')

But after updating the WPML plugins the string translations stopped working. I can see the translations in backend but it stopped translating in the frontend and I can see the original text.

I checked what is happening and found if I provide a text-domain as the second argument the translations start working again

eg: __('some text to translate','WordPress')

I can also see in “wp-includesl10n.php” that if a second argument is not passed then “default” is taken as the text-domain

function __( $text, $domain = 'default' ) {
    return translate( $text, $domain );

I am confused then how it keep working if I revert back the WPML. All the string translations that worked with the old version were using “WordPress” as the domain.

, , , Unnikrishnan R 4 years 2020-02-24T08:38:25-05:00 0 Answers 119 views 0

Leave an answer