• I have installed the en-NZ language pack because my website is based in New Zealand.

    It does have an one annoyance though…. the greeting it gives is “G’day” which is Australian, not New Zealand. I want to change it to our national greeting which is “Kia ora”

    I have edited the en_NZ.po language file in /wp-content/languages but it doesn’t seem to make any difference.

    Is there another file somewhere else that I need to also change?

Viewing 5 replies - 1 through 5 (of 5 total)
  • In a Child Theme functions.php (or create your custom function) use this example where the default is “Howdy” and is replaced with “Welcome”:

    
    function cust_replace_howdy( $text ) {
        $newtext = 'Welcome';
        if ( is_user_logged_in() ) {
            $text = str_replace( 'Howdy', $newtext, $text );
        }
        return $text;
    }
    add_filter( 'gettext', 'cust_replace_howdy' );
    

    You can also use this to show or hide the admin bar for non-admin users:

    
    if ( current_user_can( 'manage_options') ) {
    add_filter ('show_admin_bar', '__return_true');
    } else {
    add_filter ('show_admin_bar', '__return_false');
    }
    
    Thread Starter kiwihawk

    (@kiwihawk)

    Thank you, that worked a treat. And it got me to thinking about adding a little bit of magic to it.

    
    function howdy_message($translated_text, $text, $domain) {
      $message = public_holiday();
        $new_message = str_replace('Howdy', $message, $text);
        return $new_message;
    }
    add_filter('gettext', 'howdy_message', 10, 3);
    //
    function public_holiday() {
      $date = date('d-m');
      switch($date) {
        case '01-01':
          $message = 'Happy New Years';
        break;
    
        case '21-06':
          $message = 'Happy Yule';
        break;
     
        case '21-12':
          $message = 'Happy Summer Solstice';
        break;
    
         case '25-12':
          $message = 'Merry Christmas';
        break;
    
        default:
          $message = 'Kia ora';
      }
      return $message;
    }
    

    The thing is, up until the latest WordPress update New Zealand WP sites said “Kia Ora” – not “G’day” which, as kiwihawk said, is Australian. Kia Ora is our traditional greeting and was correct. Is there a reason it was changed in the latest update?

    Is there a reason it was changed in the latest update?

    You would have to ask core folks that, or whoever provided the language file.

    Thanks… will do.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Edit Language’ is closed to new replies.