WordPress.org

Ready to get started?Download WordPress

Forums

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 -
    http://twitpic.com/9yljnm

    Example of correct English language -
    http://twitpic.com/9ylk5j

    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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

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

  7. marco-raaphorst
    Member
    Posted 1 year 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 1 year ago #

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

  9. marco-raaphorst
    Member
    Posted 1 year ago #

  10. Unsal Korkmaz
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

    thanks a lot! works fine now.

  12. Suggymoto
    Member
    Posted 1 year ago #

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

    Thanks

  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?

    http://wordpress.org/support/topic/wrong-language-in-twitter-embeds?replies=13#post-3550953

    So - yes, functions.php.

  15. Suggymoto
    Member
    Posted 1 year ago #

    Thanks :)

    Cheers unsalkorkmaz! Worked perfectly.

  16. Unsal Korkmaz
    Member
    Posted 1 year ago #

    zoonini is your problem still continue?
    You can send me problematic website via contact form:
    http://unsalkorkmaz.com/iletisim/

    I cant help without see the problem.

Topic Closed

This topic has been closed to new replies.

About this Topic