Skip to:
Content
Pages
Categories
Search
Top
Bottom

bbpress.pot is missing line


  • mvasicm
    Participant

    @mvasicm

    Hello,

    I need to translate this line into my language:

    “ERROR: Your topic needs a title.”

    I have the latest bbpress installed, but the .POT file is missing this line. Can you help?

    Thanks

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

  • Robin W
    Moderator

    @robin-w

    I hope the theme authors read this.

    In the meantime either add it manually and keep a note

    or add this to your functions file

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    	if ( $translated_text == 'old text' ) {
    	$translated_text = 'new text';
    	}
    	return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text', 20 );
    

    just put the old and new words to change ‘old test’ and ‘new text’

    Functions files and child themes – explained !


    mvasicm
    Participant

    @mvasicm

    Hello Robin,

    thanks for quick response.

    I tried to add manually into .po file, but it doesnt work I dont know why…

    #~ msgid “ERROR: Your topic needs a title.”
    #~ msgstr “CHYBA: Vaše téma musí mít název.”

    Then I tried your way, function file, but there seems to be error in your code. It says:

    Parse error: syntax error, unexpected ‘:’ in /data/web/virtuals/82697/virtual/www/domains/investplanet.cz/wp-content/themes/sahifa/functions.php on line 139


    mvasicm
    Participant

    @mvasicm

    I changed syntax and the code is ok, but nothing happen on the page.

    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    if ( $translated_text == “ERROR: Your topic needs a title.” ) {
    $translated_text = “CHYBA: Vaše téma musí mít název.”;
    }
    return $translated_text;
    }
    add_filter( ‘gettext’, ‘change_translate_text’, 20 );

    ?>


    Robin W
    Moderator

    @robin-w

    I just looked and it’s actually in the code as

    <strong>ERROR</strong>: Your topic needs a title.
    

    and the translate works on exact !

    which might explain why it didn’t work in the pot

    you can try it as one phrase, and if that doesn’t work, then make it two

    ie
    //This function changes the text wherever it is quoted
    function change_translate_text( $translated_text ) {
    if ( $translated_text == ‘ERROR:’ ) {
    $translated_text = ‘CHYBA:’;
    }
    if ( $translated_text == ‘Your topic needs a title.’ ) {
    $translated_text = ‘Vaše téma musí mít název.’;
    }

    return $translated_text;
    }
    add_filter( ‘gettext’, ‘change_translate_text’, 20 );

    The same is probably true of the POT file, so you try all that there first !


    mvasicm
    Participant

    @mvasicm

    Am I right that I should put this code into functions.php file in my theme right?

    Im still getting english version.

    error message


    Robin W
    Moderator

    @robin-w

    yes in your functions file !


    Robin W
    Moderator

    @robin-w

    if it still doesn’t work, come back and when I get a moment I’ll try it in my test site


    mvasicm
    Participant

    @mvasicm

    Im doing everything exactly according to your advice, but it still doesnt work. If you have a minute and take a look you will be the best.
    Thanks


    Robin W
    Moderator

    @robin-w

    the following works

    //This function changes the text wherever it is quoted
     function change_translate_text( $translated_text ) {
     if ( $translated_text == '<strong>ERROR</strong>: Your topic needs a title.' ) {
     $translated_text = '<strong>CHYBA</strong>: Vaše téma musí mít název.';
     }
     
    return $translated_text;
     }
    
    add_filter( 'gettext', 'change_translate_text', 20 );
    

    but equally well, the line is in the pot on line 3727 as

    Line 3727: msgid "<strong>ERROR</strong>: Your topic needs a title."

    so you could just use then normal translate !

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.
Skip to toolbar