Does WPML translate numbers automatically, or do I have to do the string translation? [closed]
It is better to use gettext calls, according to WPML Guidelines.
It is better to use gettext calls, according to WPML Guidelines.
Translation not working for Constant strings in Plugin
Replace plugin HTML to single text using hooks
How to find which .mo file is responsible for displaying a particular localized string?
Your code use load_theme_textdomain. If you are in child theme and need to load translated strings, use function load_child_theme_textdomain. Please take a look this answer too Override parent theme translation on child 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
WordPress doesn’t automatically translate anything, you need to use the __ and _e functions, even in your config file, if you want it to be translateable. define( ‘CONSTANT’, __( ‘some string’, ‘textdomain’ ) );
My first thought would be to wrap the string in a trim() statement: <?php _e( trim($text), $domain ) ?> Would this do what you are wanting it to do or did I misunderstand your question? EDIT: On looking further at the docs, while technically you may be able to get away with passing a variable, … Read more
PHP can read the ‘HTTP_ACCEPT_LANGUAGE’ header from the browser request, but this might not be easy to parse if there is more than one accepted language set. For the simplest case, when one language is set as accepted, you need to read only first 2 characters from this header: $language = substr($_SERVER[‘HTTP_ACCEPT_LANGUAGE’], 0, 2); But, … Read more
Everything you have tried should have worked perfectly, I am not sure why is this not working, I am modifying your code a little bit to check for post type, check if it can help you, function rename_publish_button_to_review( $translation, $text ) { if( !current_user_can(‘administrator’) && ‘post’ == get_post_type() ) { if( ‘Publish’ == $text ) … Read more