Wrong Language in Twitter Embeds
-
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/9yljnmExample of correct English language –
http://twitpic.com/9ylk5jI found this thread that seems to be related, but there’s no resolution: http://ww.wp.xz.cn/support/topic/twitter-oembed-language?replies=7&view=all
Thanks for any ideas.
-
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
Very cool – thanks for the heads-up and sample code.
Pardon my ignorance. Where would I paste the filter to solve this? Server hosted in Germany so all tweets showing German.
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.Hey, I have the same problem. Tweets are being displayed in Hindi, even after adding this filter. Any ideas?
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?
If you need further support than that provided in this thread, create a thread on the issue.
created a new topic for this issue, here:
http://ww.wp.xz.cn/support/topic/wrong-language-in-twitter-embeds-via-oembed
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/
thanks a lot! works fine now.
Noob question. Where would I paste this? My theme’s functions.php?
Thanks
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?
Noob question. Where would I paste this? My theme’s functions.php?
http://ww.wp.xz.cn/support/topic/wrong-language-in-twitter-embeds?replies=13#post-3550953
So – yes, functions.php.
Thanks š
Cheers unsalkorkmaz! Worked perfectly.
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.
The topic ‘Wrong Language in Twitter Embeds’ is closed to new replies.