Permalink
Browse files

added translation option to translate all tweet output

bumped version to 0.50
  • Loading branch information...
1 parent 9973960 commit 929ae9f55d93d0b75f132db17782ed7f996aa5c6 @chrisalexander chrisalexander committed Jan 5, 2011
Showing with 45 additions and 4 deletions.
  1. +1 −1 manifest.json
  2. +16 −2 options.html
  3. +20 −0 options.js
  4. +8 −1 popup.js
View
@@ -1,6 +1,6 @@
{
"name": "TweetMeme",
- "version": "0.4",
+ "version": "0.50",
"description": "Retweet the hottest stories on Twitter with TweetMeme",
"icons": {
"16": "16x16.png",
View
@@ -1,11 +1,12 @@
<!DOCTYPE html>
<html>
<head>
+ <meta charset="utf-8" />
<link rel="stylesheet" href="options.css" type="text/css" charset="utf-8" />
<script src="blacklist.js"></script>
<script src="options.js"></script>
</head>
- <body onload="updateBlacklistOutput();">
+ <body onload="updateBlacklistOutput();selectLang();">
<div id="wrapper">
<div id="header">
<h2 id="logo"><a href="http://tweetmeme.com" title="TweetMeme, Hottest Stories on Twitter">TweetMeme, Hottest Stories on Twitter</a></h2>
@@ -27,6 +28,19 @@ <h1 id="about">About TweetMeme Extension</h1>
<p>It shows you a realtime count of the number of tweets the page you're currently viewing has, as well as allowing you to tweet
the page from wherever you are - just click on the button!</p>
<h1 id="options">Options</h1>
+ <h3>Language</h3>
+ <p>TweetMeme has the ability to automatically translate the tweet text you send into a language of your choice.</p>
+ <p>Select the language you wish to have all tweets translated into. Select "No translation" to keep all tweets in their original language.</p>
+ <select id="lang" onchange="javascript:updateLang()">
+ <option value="">No translation</option>
+ <option value="en">English</option>
+ <option value="fr">Français</option>
+ <option value="it">Italiano</option>
+ <option value="de">Deutsch</option>
+ <option value="ja">日本 (Japanese)</option>
+ <option value="es">Español</option>
+ <option value="pt">Português</option>
+ </select>
<h3>Blacklist</h3>
<p>You can blacklist domains for which you do not want the button to grab a count for.</p>
<p>When you visit URLs on these domains, we will not contact TweetMeme to get tweet count details.</p>
@@ -66,4 +80,4 @@ <h1 id="faq">FAQ</h1>
</div>
</div>
</body>
-</html>
+</html>
View
@@ -44,4 +44,24 @@ function updateBlacklistOutput()
o.innerHTML = o.innerHTML + '<li><span>' + i + '</span><button onclick="processRemoveFromBlacklist(\'' + i + '\');" class="rbtn">X</button></li>';
}
}
+}
+
+/**
+* Called when lang dropdown is changed to save the lang code
+*/
+function updateLang()
+{
+ langbox = document.getElementById('lang');
+ localStorage["language"] = langbox.value;
+}
+
+/**
+* Populates the language dropdown with the right option
+*/
+function selectLang()
+{
+ lang = localStorage["language"];
+ if (lang!=undefined) { // a lang is defined
+ document.getElementById('lang').value = lang;
+ }
}
View
@@ -126,7 +126,14 @@ document.observe("dom:loaded", function() {
* This will force TweetMeme to resolve it and provide a title if
* it doesn't exist on TweetMeme already.
*/
- new Ajax.Request("http://api.tweetmeme.com/v2/buildTweet.json?url=" + tab.url,
+ language = localStorage["language"];
+ if (language==undefined) {
+ language = "";
+ localStorage["language"] = "";
+ }
+ console.log("Translation: '" + language + "'");
+
+ new Ajax.Request("http://api.tweetmeme.com/v2/buildTweet.json?translate=" + language + "&url=" + tab.url,
{
/**
* Successful response

0 comments on commit 929ae9f

Please sign in to comment.