Translating a pager string

You are doing it wrong You should translate the HTML string, not the function When passing strings into functions, like what you are doing, you should use __() which returns the translated string. _e() would echo the string and you would get the raw text and the modified text on output Example of correct usage: … Read more

How to add a translatable string to post date

You should use placeholders: $time = sprintf( ‘<i class=”fa fa-clock-o” aria-hidden=”true”></i> %s: <time datetime=”%s”>%s</time>’, esc_html__(‘Posted on’, ‘textdomain’), get_the_time(‘Y-m-d’), get_the_time(‘j F Y’) );

How do you translate comments_number function text in a theme?

You have to make these strings translatable by using __() function: comments_number( __(‘Comments (0)’), __(‘Comments (1)’), __(‘Comments (%)’) ); If you want to use the custom textdomain, e.g. ‘test’: comments_number( __(‘Comments (0)’, ‘test’), __(‘Comments (1)’, ‘test’), __(‘Comments (%)’, ‘test’) ); For more information see: __() Theme internationalization Very good article by Samuel Wood a.k.a. Otto: … Read more

Localization of WP theme

Wrap the elements of $search and $replace arrays into __() function to get the translated strings: function search_replace_search() { $search_term = esc_attr( apply_filters( ‘the_search_query’, get_search_query( false ) ) ); // Get search term $search = array( __(‘word1’), __(‘word2’) ); $replace = array( __(‘something 1’), __(‘something 2’) ); $replacePairs = array_combine($search, $replace); echo strtr($search_term, $replacePairs); } … Read more

Update-safe translating of single text string in plugin

to use the file wp-content/languages/plugins/albdesign-wc-donations-uu_UU.mo in the plugin, it has to be declared like that : load_plugin_textdomain(“albdesign-wc-donations”); // search in wp-content/languages/plugins/ // search in the plugin files if not found in wp-content/languages/plugins/ load_plugin_textdomain(“albdesign-wc-donations”, FALSE, plugin_dir_path(__FILE__) . “languages/”); is it’s not the case, you can create another plugin to correct that loading of the translations files