Skip to:
Content
Pages
Categories
Search
Top
Bottom

Rename Labels

  • Avatar of matheuwhitehead
    matheuwhitehead
    Participant

    @matheuwhitehead

    Hi,

    I have began to edit the PO file to rename some of the labels, although notice there are some labels I am unable to change.

    For example I am in the process of changing Course to Wiki and I have change the majority of it, although cannot change the ‘New Course’ input form labels, which are:

    - Add a New Course (Title)
    - Course Title (Field)
    - Add a New Course (Button)

    Hope that makes sense, will help me if I could understand where to change this, much appreciated!

    Matt

Viewing 2 replies - 1 through 2 (of 2 total)
  • Avatar of Stas SuČ™cov
    Stas Su?cov
    Participant

    @sushkov

    po files are what should be updated.
    Though, I wrote something like this, to replace any appearence of word group, you can use it as an example.
    `
    /**
    * Project specific string changes
    */
    function learn_gettext( $translation, $text ) {
    $dirty = false;
    $strings_map = array(
    ‘group’ => ‘class’,
    ‘groups’ => ‘classes’,
    ‘Group’ => ‘Class’,
    ‘Groups’ => ‘Classes’
    );

    $text_words = explode( ‘ ‘, $text );

    // Try to find strings to be replaced and preserve the punctuation
    foreach ( $text_words as $k => $word ) {
    $w = trim( $word, ‘.,:!?-_()’ );
    if ( isset( $strings_map[ $w ] ) ) {
    $text_words[ $k ] = str_replace( $w, $strings_map[ $w ], $word );
    $dirty = true;
    }
    }

    if ( $dirty ) {
    return implode( ‘ ‘, $text_words );
    }

    return $translation;
    }
    add_filter( ‘gettext’, ‘learn_gettext’, 10, 2 );
    `

    Avatar of JeffE
    JeffE
    Participant

    @jeffe

    @sushkov is this still a recommended way to change the label for “Groups”? If so, where do you put this code?

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.