stuart-d
7/19/2012 - 2:23 PM

WordPress Translate Text testing Snippet - this snippet when added to a themes functions.php file will let you test if the Localization of a

WordPress Translate Text testing Snippet - this snippet when added to a themes functions.php file will let you test if the Localization of a word or text string is taking effect and changing within a theme or plugin without using the translation .MO and .PO files.

function translate_text( $translated ) {

  // The first parameter is the original text, the second parameter is the changed text.
  $translated = str_ireplace( 'Choose and option',  'Select',  $translated );

  // Returns the translated text
  return $translated;

}
add_filter( 'gettext',  'translate_text' );
add_filter( 'ngettext',  'translate_text' );