embedded tweets in French instead of Dutch, why? (9 posts)

  1. marco-raaphorst
    Posted 3 years ago #

    my embedded tweets have French text-buttons instead of Dutch. check for example:

    is like this since months. can't stand it any longer. what is causing it?

  2. marco-raaphorst
    Posted 3 years ago #

    it seems to be a server config setting. so if the server is located in Belgium this can happen.

    how can I solve/change this? and why is it not using the language settings of the blog? I guess this is a bug.

  3. Embedded Tweets are supposed to be using the language of the HTML lang attribute and on your site that's plainly set like so.

    <html lang="nl-NL">

    See https://dev.twitter.com/docs/embedded-timelines for an explanation:

    Language: The widget language is detected from the page, based on the HTML lang attribute of your content. You can also set the HTML lang attribute on the embed code itself.

    If you haven't done so try this: make a backup copy of your wp-config.php for safe keeping then locate the lines that says

    define('WPLANG', '');

    And make that

    define('WPLANG', 'nl_NL');

    Then re-embed that tweet. That's required to get the oEmbed results again.

    If all goes well then the text buttons should come up in Dutch. This worked on my test installation and the text buttons for me came up in Dutch.

  4. marco-raaphorst
    Posted 3 years ago #

    WPLANG has been set for years like that. doubled checked it.

    I guess it's some server setting which is misused for these oembeds.

  5. Bart Stroeken
    Posted 3 years ago #

    Your HTMLtag has lang nl-NL in stead of nl_NL (note the difference:-))

    As it says in Jan's quoted text: you can set the lang attribute on your embedcode as well (<a lang="nl_NL" class="...)

  6. marco-raaphorst
    Posted 3 years ago #

    Hi Bart, I'm using oEmbed, so no embedded code. Simply adding the URL. Nothing about language whatsoever.

    As you can see in de HEAD this is set:
    <html class="ie" lang="nl-NL">

    The problems occurs in oEmbed. It uses a server setting I guess instead of the language setting. #bug

  7. marco-raaphorst
    Posted 3 years ago #

    just to make sure, the header.php uses:

    <!--[if lte IE 8]>
    <html class="ie" <?php language_attributes(); ?>>
    <html <?php language_attributes(); ?>>

    This seems to be correct. In WP-config.php the setting is:
    define('WPLANG', 'nl_NL');

    But in HEAD it's uses '-' instead of '_'. This is handled by WordPress in language_attributes() function. If that's not correct, WordPress should change that function.

  8. marco-raaphorst
    Posted 3 years ago #

    here's a fix but that doesn't work on my system"

    what can be the cause of it? very weird problem! unsolved still.

  9. Unsal Korkmaz
    Posted 3 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/

Topic Closed

This topic has been closed to new replies.

About this Topic