Changing text strings

  • Fed

    #4722

    I am trying to change some of the text strings. I found the reference in the apparent default language file (en_gb.po)

    I changed an part of it to:

    #: comments.php:131

    msgid “Your email address will not be published. I still advise that you do not use your real name or email.”

    msgstr “”

    This did not change anything. Do I have to do something else?

    Please help, and many thanks,

    Fed

    Mod

    Kenneth John Odle

    #28977

    Moved to Support. Please be sure to post in the correct section.

    Why would you advise people not to use their real name or email? This is to help prevent spam comments.

    Fed

    #28978

    Sorry about posting in the wrong section.

    I don’t want people to include their name because of privacy issues. It is a health related site.

    Anonymous

    #28979

    It doesn’t work if you change the string only in en_GB.po file. You have to update .mo file as well. Because en_GB.mo is what a machine readable binary file. Also, make sure you’re using en_GB as your language in wordpress.

    Why don’t you just use GetText to translate/change strings?

    function graphene_filter_gettext( $translated, $original, $domain ) {
    $strings = array(
    'Your email address will not be published.' => 'Your email address will not be published. I still advise that you do not use your real name or email.',
    );
    if ( ! empty( $strings[$original] ) ) {
    $translations = &get_translations_for_domain( $domain );
    $translated = $translations->translate( $strings[$original] );
    }
    return $translated;
    }
    add_filter( 'gettext', 'graphene_filter_gettext', 10, 3 );

Viewing 4 posts - 1 through 4 (of 4 total)

  • You must be logged in to reply to this topic.