Localization of WP theme
I am working on WP theme localization. On custom search template I have function which gets text of some search terms and replace them with other (just visually).
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);
}
echo search_replace_search();
How to wrap search orreplace words, or function output (echo), so WP will use translation of words (in this example "something 1" and "something 2") from theme's .mo files. I 've tried various ways to wrap this into gettext, without success.
Topic xgettext localization translation Wordpress search
Category Web