Embedded Facebook is in wrong language

Posted in: Newspaper
Post count: 31

Hello,

When I insert posts from Facebook they appears in weird language.

http://prntscr.com/f7od71
Example

How/where to change this so it shows in the same language as a website?

Regards,

Post count: 9544

Theme does not control embedded Facebook posts, as that is loaded via Facebook, and via the OEMBED built in to WordPress. Probably one option is to ensure you manually add the language your site is actually in, within the wp-config.php file, especially if not default “english”…

Language of FB embed is usually based on the person viewing the site browser setting, or in some cases the language of the original FB post with option to translate.

( I don’t work here .)

Post count: 31

Thank you Chris. I think that was the case until wordpress ver. 4. Now it appears define(‘WPLANG’, ”); is depreciated. I selected my site language in ‘Settings>General’.

In the source of posts I have found this:

<script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/ar_AR/sdk.js#xfbml=1&version=v2.3"; fjs.parentNode.insertBefore(js, fjs);}(document, 'script', 'facebook-jssdk'));</script>

I believe that if I manage to change ar_AR to my website language that would fix the issue, however I have no idea where to change it.

I still need help with that.

Post count: 20688

Hi,

I have found a similar topic with the problem that you are describing
http://stackoverflow.com/questions/41550989/wordpress-loading-wrong-language-for-facebook-sdk
Maybe you can try the code provided and see if it fixes the issue.

Thanks

Post count: 31

Thank you guys,

I added this:
add_filter( 'the_content', 'facebook_sdk_replace' );
function facebook_sdk_replace( $content ) {
if ( is_single() ) {
$content = str_replace("/ar_AR/", "/pl_PL/", $content);
}
return $content;
}

and embedded Facebook is showing in the same language as my site.

Post count: 10

Where did you add the code?

Viewing 6 posts - 1 through 6 (of 6 total)
The forum ‘Newspaper’ is closed to new topics and replies.