Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #914537
    kiaallentoft
    Participant

    Hi,

    How can I translate the ‘blog texts’ to Danish?
    I used a template, and need to translate:
    – View Post
    – In
    – Recent Posts
    …etc.

    Hope you can help – see photo attached.

    Thanks, Kia.

    #947009
    Joao
    Moderator

    Hi Kia,

    Please have a look at this link.

    https://community.theme.co/kb/translation/

    Hope that helps,

    Joao

    #979190
    kiaallentoft
    Participant

    This did not work.
    I followed the steps in the article, but something is wrong. The blog is still English.

    I attached photo of FTP – what can I have done wrong?

    I pasted the case in functions.php – does this code need editing?

    Thanks ;o)

    KR, Kia

    #979773
    Rue Nel
    Moderator

    Hello There,

    Thanks for writing in! Please upload the _x_-xxxx.xx file to your server. The best place to upload is in this folder wp-content/languages/themes/ and make sure that the filename is this:

    
    __x__-da_DA.po
    __x__-da_DA.mo

    If still some of the text were not translated, please add this custom function in your child theme’s functions.php file

    add_filter('gettext', 'translate_text' );
    function translate_text($translated) { 
      $translated = str_ireplace('View Post', 'Insert your text translation', $translated);
      return $translated; 
    }

    Please let us know how it goes.

    #980856
    kiaallentoft
    Participant

    Oh, this is still not working correct.
    My news page still says ‘View Post’ in the header.

    I uploaded the files with the correct name as you told me and also added the text to functions.php.

    What could I have missed?

    Thanks so much for your support!

    #980863
    Christian
    Moderator

    Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    #980972
    kiaallentoft
    Participant
    This reply has been marked as private.
    #981299
    Rad
    Moderator

    Hi there,

    1. Please remove this code from your child theme’s style.css

    add_filter( 'gettext', 'replace_search_string', 20, 3 );
    function replace_search_string( $search_text, $text, $domain ) {
        if ( $text == 'Type and Press “enter” to Search' ) return __( 'Søg', $domain );
        else return $search_text;
    }
    
    add_filter('gettext', 'translate_text' );
    function translate_text($translated) { 
      $translated = str_ireplace('View Post', 'Insert your text translation', $translated);
      return $translated; 
    }
    

    2. Then add this code to your child theme’s functions.php

    add_filter('gettext', 'view_post_translation', 20, 3  );
    function view_post_translation( $translated_text, $text, $domain ) { 
      $translated = ( $text == 'View Post' ? 'Se indlæg' : $translated_text );
      return $translated; 
    }

    Please do not add the code to child theme’s style.css, it should be added to child theme’s functions.php

    CSS is for style.css, while PHP is fore functions.php

    Thanks!

    #982591
    kiaallentoft
    Participant

    Thank you SO MUCH for your assistance. This was perfect!

    Can you tell me how to translate this text also (attached photo)?

    It is the comment field under each news…

    Thank you.

    Sunshine & smiles

    #983146
    Jade
    Moderator
  • <script> jQuery(function($){ $("#no-reply-914537 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>