WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. marco-raaphorst
    Member
    Posted 1 year ago #

    my embedded tweets have French text-buttons instead of Dutch. check for example:
    http://marcoraaphorst.nl/27654/the-wire-over-de-impact-van-elektriciteit-op-muziek/

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

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

    just to make sure, the header.php uses:

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

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

    here's a fix but that doesn't work on my system"
    http://wordpress.org/support/topic/wrong-language-in-twitter-embeds?replies=7#post-3689021

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

  9. 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/

Topic Closed

This topic has been closed to new replies.

About this Topic