Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1191550

    Hi team :)

    I’m using these two snippets in my template-builder.php, to show social share and related post, at the end of blog posts:

    ======================
    //show social share on single blog posts
    if(is_singular(‘post’)) {
    echo do_shortcode(“[av_social_share title=".__('Share this entry','avia_framework')." style='' buttons='' share_facebook='' share_twitter='' share_pinterest='' share_reddit='' share_linkedin='' share_tumblr='' share_vk='' share_mail='' av-desktop-hide='' av-medium-hide='' av-small-hide='' av-mini-hide='']“);
    // end social share

    //show related posts based on tags if there are any
    get_template_part( ‘includes/related-posts’);
    // end related posts
    }
    ======================

    But I’m having an issue with the texts inserted not following the language files in use. So the first block will say “Share” and the second “You might also like” – no matter what language is used :(

    Can you tell me how to adapt the script to match the language in question?

    Thanks :)
    Thomas

    #1191961

    Hey autopilotdk,

    Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?

    Best regards,
    Victoria

    #1192169
    This reply has been marked as private.
    #1192728

    Hi autopilotdk,

    Looks like this file is missing this translation
    enfold/lang/da_DK.po

    You can edit the file and add your translation there.

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #1192800

    Hi Victoria!

    That’s really weird. When I download the da_dk.po file and review it in Poedit, the translations are there:

    View post on imgur.com

    View post on imgur.com

    Are we looking at the same thing? Or aren’t those the right fields ?

    Best regards,
    Thomas

    #1193276

    Hi Thomas,

    Hmm.. that’s very weird. Can you remove the code form the child theme and see if it’s going to get translated? You can just comment it out for the test.

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #1193500

    Hi Victoria.

    I’m afraid I don’t follow. :/

    If I remove this:

    //show social share on single blog posts
    if(is_singular(‘post’)) {
    echo do_shortcode(“[av_social_share title=".__('Share this entry','avia_framework')." style='' buttons='' share_facebook='' share_twitter='' share_pinterest='' share_reddit='' share_linkedin='' share_tumblr='' share_vk='' share_mail='' av-desktop-hide='' av-medium-hide='' av-small-hide='' av-mini-hide='']“);
    // end social share
    
    //show related posts based on tags if there are any
    get_template_part( ‘includes/related-posts’);
    // end related posts
    }

    from template-builder.php nothing gets translated, because there’s nothing to see. No “Share” block and no “You might also like” block…

    Am I missing something here?

    /Thomas

    #1193640

    Hi Thomas,

    Oh, sorry, I meant if you have a pos built with the classic editor do those things get translated?

    Best regards,
    Victoria

    #1193654

    Hi Victoria.

    Ahh, that makes more sense :D

    I’ve published a post built without clicking “advanced layout editor”

    It’s in Danish (html lang=”da-DK”), but the Share and You might also like texts appear in English.

    #1194481

    Hi autopilotdk,

    Hmmm…. Lools like this was an issue before:
    https://kriesi.at/support/topic/share-this-entry-is-not-being-translated/

    Did you update the footer.php with a fresh copy?

    Best regards,
    Victoria

    #1194809

    Hi Victoria!

    Well, it hadn’t occurred to me that the footer.php would influence translations in main content. Don’t you mean functions.php?

    If I add this to functions.php, it works for the “Share” text:

    add_filter('avia_social_share_title','av_translate_social_share_title');
    function av_translate_social_share_title() {
    	if (get_locale() == 'da_DK') {
        return "Share this entry in Danish";
    	}
    }

    Do you have a similar fix for “You might also like” text?

    Thanks.
    Thomas

    • This reply was modified 4 years, 4 months ago by autopilotdk.
    #1194916

    Hi Thomas,

    Well, unfortunately, there is no filter around that text, you can add the check in the file yourself. Here /includes/related-posts.php
    Image 2020-03-20 at 20.19.51.png

    The footer file has the closing body tag and some scripts are added there and anyway, all files in the child theme have to be updated manually when the parent theme updates.

    Best regards,
    Victoria

    #1195398

    Hi Victoria!

    Awesome, thanks for the help :) I’ve included language sensitive headlines in related-posts.php and it works.

    Now that we’re getting the “you might also likes” up and running, I notice that recommendations are made across languages. So an English post might recommend a Danish post. Can we change that, so users are only recommended posts in their chosen language?

    Example in English, recommending Danish post:

    Thanks in advance :)
    Thomas

    #1198021

    Hi autopilotdk,

    Glad you got that part working :)

    https://share.getcloudapp.com/geu2DJdE I guess you need to add the right categories and languages to the posts.

    If you need further assistance please let us know.
    Best regards,
    Victoria

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.