Support » Plugin: Rotating Tweets (Twitter widget and shortcode) » How to set language of tweet?

  • Could you share how to set the language? That is the API supports language = en I believe so was wondering where I would need to add that to make sure a particular polling of tweets are in that language?

    To note, this is to only show tweets of a certain language, rather than changing the follow buttons etc into a certain language which I saw in the readme. Thank you!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Martin Tod


    It’s possible in theory – though not yet implemented!

    The Search API lets you set the language – and Tweet objects are sometimes (not always) language coded as well so it should be possible to filter on them.

    Good idea for the future.

    Thanks for getting so quickly. Can you point me in the right direction on how I would implement it?

    That is, it’s fine if currently there isn’t a short code parameter for it, and wouldn’t mind temporarily hard coding a change such as lang=en somewhere in the plugin code and updating that each time I update the plugin temporarily until it’s been officially added to the plugin.

    Hoping it’s just a matter of adding lang=”en” or something somewhere. I can look myself but imagine you will have a good starting place.

    Oh and yes, its okay if some non english get through, as long as it filters out most, so I’m fine with whatever lang=”en” results include based on their filters.

    Plugin Author Martin Tod


    It’s pretty trivial to implement on searches. Change line 1191 to:
    and that should work nicely.

    It’s a lot harder to implement on regular queries.

    Wow, you rock, thanks so much, worked perfectly!

    Spoke to soon, actually looks like still running into issues. To confirm

    if($tw_search) {

    Should be replaced with this?

    if($tw_search) {

    Or should “$apioptions[‘lang’]=’en’;” be added after the line “$apioptions[‘q’]=$tw_search;”. When replacing it looks like I’m getting and error after clearing my cache. I put it after it looks like lots of multi languages are still coming through. Any thoughts? Thank you!

    Plugin Author Martin Tod


    It should go after.

    Language identification is controlled by Twitter. I haven’t really tested it to see how reliable it is – or even how much different this tweak to the code makes.

    Thanks again!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to set language of tweet?’ is closed to new replies.