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

Unable to find translations in WordPress theme

There are three usual possibilities: Translation files somewhere in theme’s directory. Translation files in site’s directory, defined by WP_LANG_DIR constant (typically wp-content/languages). Theme’s original strings are in different language, so that is its default state and it needs to be translated to English.

How to translate functions.php?

Added to the functions.php the next: $pather = get_stylesheet_directory().’/languages’; load_child_theme_textdomain( ‘Savia-child’, $pather ); And then called it as: __( ‘text to translate’, ‘Savia-child’); In the child theme I have created a dir: /languages and put there po and mo files with the names: [locale].po/.mp like: ru_RU.po and ru_RU.mo. That is.

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