Ready to get started?Download WordPress


Wrong Language in Twitter Embeds (16 posts)

  1. For some reason, some tweets embedded on clients' sites using the new 3.4 method are mistakenly displaying French for the wording of "reply," "retweet," etc.

    The strange thing is, it's working fine - i.e. showing English correctly - on other sites, on the same server/IP.

    Can anyone figure out why certain sites might be mistakenly showing the tweet language in French? Both installs are fully English, on the exact same server.

    Example of incorrect French language -

    Example of correct English language -

    I found this thread that seems to be related, but there's no resolution: http://wordpress.org/support/topic/twitter-oembed-language?replies=7&view=all

    Thanks for any ideas.

  2. Jennifer M. Dodd
    Posted 2 years ago #

    I had the same problem; my tweets were consistently coming back in Chinese (even using command-line curl), but my web host insisted that there was nothing wrong with the server setup. You can fix this in the upcoming 3.5 release of WordPress with a filter on oembed_fetch_url.

    Example code: https://gist.github.com/4055427

  3. Very cool - thanks for the heads-up and sample code.

  4. Suggymoto
    Posted 2 years ago #

    Pardon my ignorance. Where would I paste the filter to solve this? Server hosted in Germany so all tweets showing German.

  5. Jennifer M. Dodd
    Posted 2 years ago #

    You could paste it in your theme's functions.php. I've got a soon-to-be-released plugin that allows users to specify the language just for ease of use.

  6. Ram Ratan Maurya
    Posted 2 years ago #

    Hey, I have the same problem. Tweets are being displayed in Hindi, even after adding this filter. Any ideas?

  7. marco-raaphorst
    Posted 2 years ago #

    used this in functions.php but doens't work

    tried to change: $lang = 'nl';

    also doesn't work.

    what can be the reason for this?

  8. Andrew
    Forum moderator
    Posted 2 years ago #

    If you need further support than that provided in this thread, create a thread on the issue.

  9. marco-raaphorst
    Posted 2 years ago #

  10. Unsal Korkmaz
    Posted 2 years ago #

    Here proper fix:

    add_filter( 'oembed_fetch_url', 'firmasite_oembed_twitter_lang', 10, 3 );
    function firmasite_oembed_twitter_lang( $provider, $url, $args ) {
    	if ( 'twitter.com' == parse_url( $url, PHP_URL_HOST ) ) {
    		$lang = explode("-", get_bloginfo('language'));
    		$provider = add_query_arg( 'lang', urlencode( $lang[0] ), $provider );
    	return $provider;

    Details: http://unsalkorkmaz.com/twitter-embeds-in-wrong-language/

  11. marco-raaphorst
    Posted 2 years ago #

    thanks a lot! works fine now.

  12. Suggymoto
    Posted 2 years ago #

    Noob question. Where would I paste this? My theme's functions.php?


  13. Thanks for posting this function, unsalkorkmaz! Great workaround.

    The original mystery still remains - in my case, I wonder why some tweets on the same server and same IP display in English - and some in French?

  14. Noob question. Where would I paste this? My theme's functions.php?


    So - yes, functions.php.

  15. Suggymoto
    Posted 2 years ago #

    Thanks :)

    Cheers unsalkorkmaz! Worked perfectly.

  16. Unsal Korkmaz
    Posted 1 year ago #

    zoonini is your problem still continue?
    You can send me problematic website via contact form:

    I cant help without see the problem.

Topic Closed

This topic has been closed to new replies.

About this Topic