Max
Max

Reputation: 4408

Detecting the current tab language using Chrome extension?

Is there a way to use chrome API to detect the language of the current content in the current tab?

Upvotes: 2

Views: 2756

Answers (2)

Digital Plane
Digital Plane

Reputation: 38264

Use the Chrome Tabs API to select the current tab, then get the language.

Sample usage:

//Get language of current tab
chrome.tabs.getSelected(null, function(tab) {
  chrome.tabs.detectLanguage(tab.id, function(language) {
    console.log(language);
  });
});

Upvotes: 4

Daniel Brockman
Daniel Brockman

Reputation: 19290

Yes: chrome.tabs.detectLanguage. See http://code.google.com/chrome/extensions/tabs.html#method-detectLanguage.

Upvotes: 2

Related Questions