├── icon.png ├── data └── icon │ ├── icon-16.png │ ├── icon-32.png │ └── icon-64.png ├── .jpmignore ├── readme.md ├── .gitignore ├── package.json ├── lib └── main.js └── LICENSE.txt /icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoringCode/TranslateThis/HEAD/icon.png -------------------------------------------------------------------------------- /data/icon/icon-16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoringCode/TranslateThis/HEAD/data/icon/icon-16.png -------------------------------------------------------------------------------- /data/icon/icon-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoringCode/TranslateThis/HEAD/data/icon/icon-32.png -------------------------------------------------------------------------------- /data/icon/icon-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BoringCode/TranslateThis/HEAD/data/icon/icon-64.png -------------------------------------------------------------------------------- /.jpmignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | *.xpi 4 | /screenshots 5 | 6 | *.svg 7 | 8 | /.git 9 | .gitignore 10 | .gitattributes 11 | 12 | .jpmignore -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | #[Translate This!](https://addons.mozilla.org/en-US/firefox/addon/translate-this/) (v3.5.1) Icon 2 | 3 | Translate the whole entire page or just a selection using [Google Translate](http://translate.google.com). 4 | 5 | This addon is written with the Firefox [Addon SDK](https://wiki.mozilla.org/Labs/Jetpack). 6 | 7 | ##Features 8 | 9 | - Convenient toolbar button to translate the entire page. 10 | - Translate links, text, or the current page with the click of a button. 11 | - Choose your default language to translate to. 12 | - Open translations in a new tab, or in the same tab 13 | 14 | ##Development 15 | 16 | Install jpm (jetpack manager) using npm 17 | 18 | ``` 19 | npm install jpm -g 20 | ``` 21 | 22 | Install dependancies 23 | 24 | ``` 25 | npm install 26 | ``` 27 | 28 | Test Translate This! with a blank Firefox profile 29 | 30 | ``` 31 | jpm run 32 | ``` 33 | 34 | Export XPI (for distribution) 35 | 36 | ``` 37 | jpm xpi 38 | ``` 39 | 40 | ##How can I help? 41 | 42 | - [Report issues](https://github.com/BoringCode/TranslateThis/issues). 43 | - Help with active development. [Submit a pull request](https://github.com/BoringCode/TranslateThis/pulls). 44 | 45 | ###License 46 | Licensed under the [Mozilla Public License version 2.0](https://www.mozilla.org/MPL/2.0/) 47 | 48 | A project by [Bradley Rosenfeld](http://bradleyrosenfeld.com) 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ################# 2 | ## Firefox 3 | ################# 4 | 5 | *.xpi 6 | screenshots/ 7 | xpi/ 8 | 9 | node_modules/ 10 | 11 | 12 | ################# 13 | ## Eclipse 14 | ################# 15 | 16 | *.pydevproject 17 | .project 18 | .metadata 19 | bin/ 20 | tmp/ 21 | *.tmp 22 | *.bak 23 | *.swp 24 | *~.nib 25 | local.properties 26 | .classpath 27 | .settings/ 28 | .loadpath 29 | 30 | # External tool builders 31 | .externalToolBuilders/ 32 | 33 | # Locally stored "Eclipse launch configurations" 34 | *.launch 35 | 36 | # CDT-specific 37 | .cproject 38 | 39 | # PDT-specific 40 | .buildpath 41 | 42 | 43 | ################# 44 | ## Visual Studio 45 | ################# 46 | 47 | ## Ignore Visual Studio temporary files, build results, and 48 | ## files generated by popular Visual Studio add-ons. 49 | 50 | # User-specific files 51 | *.suo 52 | *.user 53 | *.sln.docstates 54 | 55 | # Build results 56 | 57 | [Dd]ebug/ 58 | [Rr]elease/ 59 | x64/ 60 | build/ 61 | [Bb]in/ 62 | [Oo]bj/ 63 | 64 | # MSTest test Results 65 | [Tt]est[Rr]esult*/ 66 | [Bb]uild[Ll]og.* 67 | 68 | *_i.c 69 | *_p.c 70 | *.ilk 71 | *.meta 72 | *.obj 73 | *.pch 74 | *.pdb 75 | *.pgc 76 | *.pgd 77 | *.rsp 78 | *.sbr 79 | *.tlb 80 | *.tli 81 | *.tlh 82 | *.tmp 83 | *.tmp_proj 84 | *.log 85 | *.vspscc 86 | *.vssscc 87 | .builds 88 | *.pidb 89 | *.log 90 | *.scc 91 | 92 | # Visual C++ cache files 93 | ipch/ 94 | *.aps 95 | *.ncb 96 | *.opensdf 97 | *.sdf 98 | *.cachefile 99 | 100 | # Visual Studio profiler 101 | *.psess 102 | *.vsp 103 | *.vspx 104 | 105 | # Guidance Automation Toolkit 106 | *.gpState 107 | 108 | # ReSharper is a .NET coding add-in 109 | _ReSharper*/ 110 | *.[Rr]e[Ss]harper 111 | 112 | # TeamCity is a build add-in 113 | _TeamCity* 114 | 115 | # DotCover is a Code Coverage Tool 116 | *.dotCover 117 | 118 | # NCrunch 119 | *.ncrunch* 120 | .*crunch*.local.xml 121 | 122 | # Installshield output folder 123 | [Ee]xpress/ 124 | 125 | # DocProject is a documentation generator add-in 126 | DocProject/buildhelp/ 127 | DocProject/Help/*.HxT 128 | DocProject/Help/*.HxC 129 | DocProject/Help/*.hhc 130 | DocProject/Help/*.hhk 131 | DocProject/Help/*.hhp 132 | DocProject/Help/Html2 133 | DocProject/Help/html 134 | 135 | # Click-Once directory 136 | publish/ 137 | 138 | # Publish Web Output 139 | *.Publish.xml 140 | *.pubxml 141 | 142 | # NuGet Packages Directory 143 | ## TODO: If you have NuGet Package Restore enabled, uncomment the next line 144 | #packages/ 145 | 146 | # Windows Azure Build Output 147 | csx 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | sql/ 155 | *.Cache 156 | ClientBin/ 157 | [Ss]tyle[Cc]op.* 158 | ~$* 159 | *~ 160 | *.dbmdl 161 | *.[Pp]ublish.xml 162 | *.pfx 163 | *.publishsettings 164 | 165 | # RIA/Silverlight projects 166 | Generated_Code/ 167 | 168 | # Backup & report files from converting an old project file to a newer 169 | # Visual Studio version. Backup files are not needed, because we have git ;-) 170 | _UpgradeReport_Files/ 171 | Backup*/ 172 | UpgradeLog*.XML 173 | UpgradeLog*.htm 174 | 175 | # SQL Server files 176 | App_Data/*.mdf 177 | App_Data/*.ldf 178 | 179 | ############# 180 | ## Windows detritus 181 | ############# 182 | 183 | # Windows image file caches 184 | Thumbs.db 185 | ehthumbs.db 186 | 187 | # Folder config file 188 | Desktop.ini 189 | 190 | # Recycle Bin used on file shares 191 | $RECYCLE.BIN/ 192 | 193 | # Mac crap 194 | .DS_Store 195 | 196 | 197 | ############# 198 | ## Python 199 | ############# 200 | 201 | *.py[co] 202 | 203 | # Packages 204 | *.egg 205 | *.egg-info 206 | dist/ 207 | build/ 208 | eggs/ 209 | parts/ 210 | var/ 211 | sdist/ 212 | develop-eggs/ 213 | .installed.cfg 214 | 215 | # Installer logs 216 | pip-log.txt 217 | 218 | # Unit test / coverage reports 219 | .coverage 220 | .tox 221 | 222 | #Translations 223 | *.mo 224 | 225 | #Mr Developer 226 | .mr.developer.cfg 227 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "translatethis", 3 | "title": "Translate This!", 4 | "id": "jid0-k75TfRGfOXPHfEZmJ9cKu5eCgLc@jetpack", 5 | "description": "Translate the whole entire page or just a selection using Google Translate.", 6 | "author": "Bradley Rosenfeld", 7 | "url": "https://github.com/BoringCode/TranslateThis", 8 | "homepage": "https://github.com/BoringCode/TranslateThis", 9 | "license": "MPL-2.0", 10 | "version": "3.5.1", 11 | "main": "lib/main.js", 12 | "engines": { 13 | "firefox": ">= 38.0a1" 14 | }, 15 | "permissions": { 16 | "multiprocess": true 17 | }, 18 | "icon": "icon.png", 19 | "preferences": [ 20 | { 21 | "name": "newTab", 22 | "title": "Open translations in new tab?", 23 | "type": "bool", 24 | "value": true 25 | }, 26 | { 27 | "name": "keyCode", 28 | "description": "Keyboard shortcut used to translate current page.", 29 | "type": "string", 30 | "value": "t", 31 | "title": "Keyboard Shortcut (CTRL+ALT+Your Key)" 32 | }, 33 | { 34 | "name": "language", 35 | "type": "menulist", 36 | "title": "Language", 37 | "value": "en", 38 | "options": [ 39 | { 40 | "value": "en", 41 | "label": "English" 42 | }, 43 | { 44 | "value": "af", 45 | "label": "Afrikaans" 46 | }, 47 | { 48 | "value": "sq", 49 | "label": "Albanian" 50 | }, 51 | { 52 | "value": "ar", 53 | "label": "Arabic" 54 | }, 55 | { 56 | "value": "az", 57 | "label": "Azerbaijani" 58 | }, 59 | { 60 | "value": "eu", 61 | "label": "Basque" 62 | }, 63 | { 64 | "value": "bn", 65 | "label": "Bengali" 66 | }, 67 | { 68 | "value": "be", 69 | "label": "Belarusian" 70 | }, 71 | { 72 | "value": "bg", 73 | "label": "Bulgarian" 74 | }, 75 | { 76 | "value": "ca", 77 | "label": "Catalan" 78 | }, 79 | { 80 | "value": "zh-CN", 81 | "label": "Chinese Simplified" 82 | }, 83 | { 84 | "value": "Chinese Traditional", 85 | "label": "zh-TW" 86 | }, 87 | { 88 | "value": "hr", 89 | "label": "Croatian" 90 | }, 91 | { 92 | "value": "cs", 93 | "label": "Czech" 94 | }, 95 | { 96 | "value": "da", 97 | "label": "Danish" 98 | }, 99 | { 100 | "value": "n1", 101 | "label": "Dutch" 102 | }, 103 | { 104 | "value": "eo", 105 | "label": "Esperanto" 106 | }, 107 | { 108 | "value": "et", 109 | "label": "Estonian" 110 | }, 111 | { 112 | "value": "tl", 113 | "label": "Filipino" 114 | }, 115 | { 116 | "value": "fi", 117 | "label": "Finnish" 118 | }, 119 | { 120 | "value": "fr", 121 | "label": "French" 122 | }, 123 | { 124 | "value": "gl", 125 | "label": "Galician" 126 | }, 127 | { 128 | "value": "ka", 129 | "label": "Georgian" 130 | }, 131 | { 132 | "value": "de", 133 | "label": "German" 134 | }, 135 | { 136 | "value": "el", 137 | "label": "Greek" 138 | }, 139 | { 140 | "value": "gu", 141 | "label": "Gujarati" 142 | }, 143 | { 144 | "value": "Haitian Creole", 145 | "label": "ht" 146 | }, 147 | { 148 | "value": "iw", 149 | "label": "Hebrew" 150 | }, 151 | { 152 | "value": "hi", 153 | "label": "Hindi" 154 | }, 155 | { 156 | "value": "hu", 157 | "label": "Hungarian" 158 | }, 159 | { 160 | "value": "is", 161 | "label": "Icelandic" 162 | }, 163 | { 164 | "value": "Indonesian", 165 | "label": "id" 166 | }, 167 | { 168 | "value": "ga", 169 | "label": "Irish" 170 | }, 171 | { 172 | "value": "it", 173 | "label": "Italian" 174 | }, 175 | { 176 | "value": "ja", 177 | "label": "Japanese" 178 | }, 179 | { 180 | "value": "kn", 181 | "label": "Kannada" 182 | }, 183 | { 184 | "value": "ko", 185 | "label": "Korean" 186 | }, 187 | { 188 | "value": "la", 189 | "label": "Latin" 190 | }, 191 | { 192 | "value": "lv", 193 | "label": "Latvian" 194 | }, 195 | { 196 | "value": "lt", 197 | "label": "Lithuanian" 198 | }, 199 | { 200 | "value": "mk", 201 | "label": "Macedonian" 202 | }, 203 | { 204 | "value": "ms", 205 | "label": "Malay" 206 | }, 207 | { 208 | "value": "mt", 209 | "label": "Maltese" 210 | }, 211 | { 212 | "value": "no", 213 | "label": "Norwegian" 214 | }, 215 | { 216 | "value": "fa", 217 | "label": "Persian" 218 | }, 219 | { 220 | "value": "pl", 221 | "label": "Polish" 222 | }, 223 | { 224 | "value": "pt", 225 | "label": "Portuguese" 226 | }, 227 | { 228 | "value": "ro", 229 | "label": "Romanian" 230 | }, 231 | { 232 | "value": "ru", 233 | "label": "Russian" 234 | }, 235 | { 236 | "value": "sr", 237 | "label": "Serbian" 238 | }, 239 | { 240 | "value": "sk", 241 | "label": "Slovak" 242 | }, 243 | { 244 | "value": "sl", 245 | "label": "Slovenian" 246 | }, 247 | { 248 | "value": "es", 249 | "label": "Spanish" 250 | }, 251 | { 252 | "value": "sw", 253 | "label": "Swahili" 254 | }, 255 | { 256 | "value": "sv", 257 | "label": "Swedish" 258 | }, 259 | { 260 | "value": "ta", 261 | "label": "Tamil" 262 | }, 263 | { 264 | "value": "te", 265 | "label": "Telugu" 266 | }, 267 | { 268 | "value": "th", 269 | "label": "Thai" 270 | }, 271 | { 272 | "value": "tr", 273 | "label": "Turkish" 274 | }, 275 | { 276 | "value": "uk", 277 | "label": "Ukrainian" 278 | }, 279 | { 280 | "value": "ur", 281 | "label": "Urdu" 282 | }, 283 | { 284 | "value": "vi", 285 | "label": "Vietnamese" 286 | }, 287 | { 288 | "value": "cy", 289 | "label": "Welsh" 290 | }, 291 | { 292 | "value": "yi", 293 | "label": "Yiddish" 294 | } 295 | ] 296 | } 297 | ], 298 | "dependencies": { 299 | "sprintf-js": "^1.0.3" 300 | } 301 | } 302 | -------------------------------------------------------------------------------- /lib/main.js: -------------------------------------------------------------------------------- 1 | /* 2 | * TranslateThis 3 | * Translate the whole entire page or just a selection using Google Translate 4 | * version 3.5.0 5 | */ 6 | 7 | "use strict"; 8 | 9 | // Import the APIs we need. 10 | var cm = require("sdk/context-menu"); 11 | var ui = require("sdk/ui"); 12 | var tabs = require("sdk/tabs"); 13 | var data = require("sdk/self").data; 14 | var notifications = require("sdk/notifications"); 15 | var { Hotkey } = require("sdk/hotkeys"); 16 | var prefs = require("sdk/simple-prefs"); 17 | var sprintf = require("sprintf-js").sprintf; 18 | 19 | //Simple addon configuration options 20 | var config = { 21 | name: "Translate This!", 22 | modifier: "ctrl-alt-", 23 | urls: { 24 | page: "https://translate.google.com/translate?ie=UTF-8&tl=%s&u=%s", 25 | text: "https://translate.google.com/#auto/%s/%s", 26 | }, 27 | icons: { 28 | default: { 29 | "16": data.url("icon/icon-16.png"), 30 | "32": data.url("icon/icon-32.png"), 31 | "64": data.url("icon/icon-64.png"), 32 | } 33 | }, 34 | toolbar: { 35 | id: "translatebutton", 36 | tooltip: "Translate This! - Page", 37 | } 38 | }; 39 | 40 | var main = { 41 | translateHotkey: null, 42 | translateButton: null, 43 | /* 44 | * init() 45 | * Load preferences and create addon UI 46 | */ 47 | init: function() { 48 | var self = this; 49 | 50 | //Watch for changes to prefs (just the hotkey) 51 | prefs.on("", self.prefChange.bind(self)); 52 | //Create the hotkey (default ctrl-alt-t) 53 | self.translateHotkey = self.makeHotkey(); 54 | //Generate button and context menu items 55 | self.createUI(); 56 | 57 | return self; 58 | }, 59 | /* 60 | * cleanup() 61 | * Called when the addon is unloaded 62 | * @param string reason 63 | */ 64 | cleanup: function(reason) { 65 | //console.log(reason); 66 | }, 67 | /* 68 | * createUI() 69 | * Creates the addon button and context menu items 70 | */ 71 | createUI: function() { 72 | var self = this; 73 | 74 | //Create addon button 75 | self.translateButton = ui.ActionButton({ 76 | id: config.toolbar.id, 77 | label: config.toolbar.tooltip, 78 | icon: config.icons.default, 79 | onClick: function() { 80 | self.translatePage(tabs.activeTab.url); 81 | } 82 | }); 83 | 84 | //Translate links 85 | cm.Item({ 86 | label: config.name + " - Link", 87 | image: config.icons.default["16"], 88 | // Show this item when a selection exists. 89 | context: cm.SelectorContext("a[href]"), 90 | // When this item is clicked, post a message to the item with the link's URL 91 | contentScript: 'self.on("click", function (node) {' + 92 | 'self.postMessage(node.href);' + 93 | '});', 94 | onMessage: function(url) { 95 | self.translatePage(url); 96 | } 97 | }); 98 | //Translate the current page 99 | cm.Item({ 100 | label: config.name + " - Page", 101 | image: config.icons.default["16"], 102 | contentScript: 'self.on("click", function() {' + 103 | 'self.postMessage(document.URL);' + 104 | '});', 105 | onMessage: function(url) { 106 | self.translatePage(url); 107 | } 108 | }); 109 | //Translate a selection 110 | cm.Item({ 111 | label: config.name + " - Selection", 112 | image: config.icons.default["16"], 113 | // Show this item when a selection exists. 114 | context: cm.SelectionContext(), 115 | // When this item is clicked, post a message to the item with the text 116 | contentScript: 'self.on("click", function() {' + 117 | 'self.postMessage(window.getSelection().toString());' + 118 | '});', 119 | //Translate text 120 | onMessage: function(text) { 121 | self.translateText(text); 122 | } 123 | }); 124 | return self; 125 | }, 126 | /* 127 | * makeHotkey() 128 | * Inits the addon hotkey and returns it 129 | * @return object hotkey 130 | */ 131 | makeHotkey: function() { 132 | var self = this; 133 | var hotkey = Hotkey({ 134 | combo: config.modifier + self.settings("keyCode"), 135 | onPress: function() { 136 | self.translatePage(tabs.activeTab.url); 137 | } 138 | }); 139 | return hotkey; 140 | }, 141 | /* 142 | * settings() 143 | * Returns the value of the passed setting 144 | * @param string setting 145 | * @return bool or value 146 | */ 147 | settings: function(setting) { 148 | var self = this; 149 | if (setting in prefs.prefs) { 150 | return prefs.prefs[setting]; 151 | } else { 152 | return false; 153 | } 154 | }, 155 | /* 156 | * open() 157 | * Opens the URL in a new tab or the current tab depending upon the user setting 158 | * @param string url 159 | */ 160 | open: function(url) { 161 | var self = this; 162 | if (self.settings("newTab")) { 163 | tabs.open(url); 164 | } else { 165 | tabs.activeTab.url = url; 166 | } 167 | return self; 168 | }, 169 | /* 170 | * translatePage() 171 | * Translates the page inline or opens the translated page depending upon user setting 172 | * @param string url 173 | */ 174 | translatePage: function(url) { 175 | var self = this; 176 | var lang = self.settings("language"); 177 | 178 | var translateURL = sprintf(config.urls.page, encodeURIComponent(lang), encodeURIComponent(url)); 179 | self.open(translateURL); 180 | 181 | return self; 182 | }, 183 | /* 184 | * translateText() 185 | * Passes text to Google Translate website for translation 186 | * @param string text 187 | */ 188 | translateText: function(text) { 189 | var self = this; 190 | 191 | var lang = self.settings("language"); 192 | if (text.trim().length === 0) { 193 | self.notify("Uh Oh!", "Looks like you selected empty text, try again"); 194 | } else { 195 | var translateURL = sprintf(config.urls.text, encodeURIComponent(lang), encodeURIComponent(text)); 196 | self.open(translateURL); 197 | } 198 | 199 | return self; 200 | }, 201 | /* 202 | * notify() 203 | * Wrapper for notifications API 204 | * @param string title 205 | * @param string text 206 | */ 207 | notify: function(title, text) { 208 | var self = this; 209 | 210 | notifications.notify({ 211 | title: config.name + " - " + title, 212 | text: text, 213 | iconURL: config.icons.default["64"] 214 | }); 215 | 216 | return self; 217 | }, 218 | /* 219 | * prefChange() 220 | * Called whenever a preference changes 221 | * Handles actions depending upon changed preference 222 | * @param string name 223 | */ 224 | prefChange: function(name) { 225 | var self = this; 226 | var pref = prefs.prefs[name]; 227 | 228 | switch (name) { 229 | case "keyCode": 230 | if (pref.length === 1 && pref.trim() !== "") { 231 | self.translateHotkey.destroy(); 232 | self.translateHotkey = self.makeHotkey(); 233 | } else { 234 | self.notify("Settings Error", "Make sure you enter a valid key code that is one character."); 235 | } 236 | break; 237 | } 238 | 239 | return self; 240 | }, 241 | } 242 | 243 | //Start the fun! 244 | exports.main = function(options, callback) { 245 | main.init(options, callback); 246 | } 247 | 248 | exports.onUnload = function(reason) { 249 | main.cleanup(reason); 250 | } -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Mozilla Public License, version 2.0 2 | 3 | 1. Definitions 4 | 5 | 1.1. “Contributor” 6 | 7 | means each individual or legal entity that creates, contributes to the 8 | creation of, or owns Covered Software. 9 | 10 | 1.2. “Contributor Version” 11 | 12 | means the combination of the Contributions of others (if any) used by a 13 | Contributor and that particular Contributor’s Contribution. 14 | 15 | 1.3. “Contribution” 16 | 17 | means Covered Software of a particular Contributor. 18 | 19 | 1.4. “Covered Software” 20 | 21 | means Source Code Form to which the initial Contributor has attached the 22 | notice in Exhibit A, the Executable Form of such Source Code Form, and 23 | Modifications of such Source Code Form, in each case including portions 24 | thereof. 25 | 26 | 1.5. “Incompatible With Secondary Licenses” 27 | means 28 | 29 | a. that the initial Contributor has attached the notice described in 30 | Exhibit B to the Covered Software; or 31 | 32 | b. that the Covered Software was made available under the terms of version 33 | 1.1 or earlier of the License, but not also under the terms of a 34 | Secondary License. 35 | 36 | 1.6. “Executable Form” 37 | 38 | means any form of the work other than Source Code Form. 39 | 40 | 1.7. “Larger Work” 41 | 42 | means a work that combines Covered Software with other material, in a separate 43 | file or files, that is not Covered Software. 44 | 45 | 1.8. “License” 46 | 47 | means this document. 48 | 49 | 1.9. “Licensable” 50 | 51 | means having the right to grant, to the maximum extent possible, whether at the 52 | time of the initial grant or subsequently, any and all of the rights conveyed by 53 | this License. 54 | 55 | 1.10. “Modifications” 56 | 57 | means any of the following: 58 | 59 | a. any file in Source Code Form that results from an addition to, deletion 60 | from, or modification of the contents of Covered Software; or 61 | 62 | b. any new file in Source Code Form that contains any Covered Software. 63 | 64 | 1.11. “Patent Claims” of a Contributor 65 | 66 | means any patent claim(s), including without limitation, method, process, 67 | and apparatus claims, in any patent Licensable by such Contributor that 68 | would be infringed, but for the grant of the License, by the making, 69 | using, selling, offering for sale, having made, import, or transfer of 70 | either its Contributions or its Contributor Version. 71 | 72 | 1.12. “Secondary License” 73 | 74 | means either the GNU General Public License, Version 2.0, the GNU Lesser 75 | General Public License, Version 2.1, the GNU Affero General Public 76 | License, Version 3.0, or any later versions of those licenses. 77 | 78 | 1.13. “Source Code Form” 79 | 80 | means the form of the work preferred for making modifications. 81 | 82 | 1.14. “You” (or “Your”) 83 | 84 | means an individual or a legal entity exercising rights under this 85 | License. For legal entities, “You” includes any entity that controls, is 86 | controlled by, or is under common control with You. For purposes of this 87 | definition, “control” means (a) the power, direct or indirect, to cause 88 | the direction or management of such entity, whether by contract or 89 | otherwise, or (b) ownership of more than fifty percent (50%) of the 90 | outstanding shares or beneficial ownership of such entity. 91 | 92 | 93 | 2. License Grants and Conditions 94 | 95 | 2.1. Grants 96 | 97 | Each Contributor hereby grants You a world-wide, royalty-free, 98 | non-exclusive license: 99 | 100 | a. under intellectual property rights (other than patent or trademark) 101 | Licensable by such Contributor to use, reproduce, make available, 102 | modify, display, perform, distribute, and otherwise exploit its 103 | Contributions, either on an unmodified basis, with Modifications, or as 104 | part of a Larger Work; and 105 | 106 | b. under Patent Claims of such Contributor to make, use, sell, offer for 107 | sale, have made, import, and otherwise transfer either its Contributions 108 | or its Contributor Version. 109 | 110 | 2.2. Effective Date 111 | 112 | The licenses granted in Section 2.1 with respect to any Contribution become 113 | effective for each Contribution on the date the Contributor first distributes 114 | such Contribution. 115 | 116 | 2.3. Limitations on Grant Scope 117 | 118 | The licenses granted in this Section 2 are the only rights granted under this 119 | License. No additional rights or licenses will be implied from the distribution 120 | or licensing of Covered Software under this License. Notwithstanding Section 121 | 2.1(b) above, no patent license is granted by a Contributor: 122 | 123 | a. for any code that a Contributor has removed from Covered Software; or 124 | 125 | b. for infringements caused by: (i) Your and any other third party’s 126 | modifications of Covered Software, or (ii) the combination of its 127 | Contributions with other software (except as part of its Contributor 128 | Version); or 129 | 130 | c. under Patent Claims infringed by Covered Software in the absence of its 131 | Contributions. 132 | 133 | This License does not grant any rights in the trademarks, service marks, or 134 | logos of any Contributor (except as may be necessary to comply with the 135 | notice requirements in Section 3.4). 136 | 137 | 2.4. Subsequent Licenses 138 | 139 | No Contributor makes additional grants as a result of Your choice to 140 | distribute the Covered Software under a subsequent version of this License 141 | (see Section 10.2) or under the terms of a Secondary License (if permitted 142 | under the terms of Section 3.3). 143 | 144 | 2.5. Representation 145 | 146 | Each Contributor represents that the Contributor believes its Contributions 147 | are its original creation(s) or it has sufficient rights to grant the 148 | rights to its Contributions conveyed by this License. 149 | 150 | 2.6. Fair Use 151 | 152 | This License is not intended to limit any rights You have under applicable 153 | copyright doctrines of fair use, fair dealing, or other equivalents. 154 | 155 | 2.7. Conditions 156 | 157 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in 158 | Section 2.1. 159 | 160 | 161 | 3. Responsibilities 162 | 163 | 3.1. Distribution of Source Form 164 | 165 | All distribution of Covered Software in Source Code Form, including any 166 | Modifications that You create or to which You contribute, must be under the 167 | terms of this License. You must inform recipients that the Source Code Form 168 | of the Covered Software is governed by the terms of this License, and how 169 | they can obtain a copy of this License. You may not attempt to alter or 170 | restrict the recipients’ rights in the Source Code Form. 171 | 172 | 3.2. Distribution of Executable Form 173 | 174 | If You distribute Covered Software in Executable Form then: 175 | 176 | a. such Covered Software must also be made available in Source Code Form, 177 | as described in Section 3.1, and You must inform recipients of the 178 | Executable Form how they can obtain a copy of such Source Code Form by 179 | reasonable means in a timely manner, at a charge no more than the cost 180 | of distribution to the recipient; and 181 | 182 | b. You may distribute such Executable Form under the terms of this License, 183 | or sublicense it under different terms, provided that the license for 184 | the Executable Form does not attempt to limit or alter the recipients’ 185 | rights in the Source Code Form under this License. 186 | 187 | 3.3. Distribution of a Larger Work 188 | 189 | You may create and distribute a Larger Work under terms of Your choice, 190 | provided that You also comply with the requirements of this License for the 191 | Covered Software. If the Larger Work is a combination of Covered Software 192 | with a work governed by one or more Secondary Licenses, and the Covered 193 | Software is not Incompatible With Secondary Licenses, this License permits 194 | You to additionally distribute such Covered Software under the terms of 195 | such Secondary License(s), so that the recipient of the Larger Work may, at 196 | their option, further distribute the Covered Software under the terms of 197 | either this License or such Secondary License(s). 198 | 199 | 3.4. Notices 200 | 201 | You may not remove or alter the substance of any license notices (including 202 | copyright notices, patent notices, disclaimers of warranty, or limitations 203 | of liability) contained within the Source Code Form of the Covered 204 | Software, except that You may alter any license notices to the extent 205 | required to remedy known factual inaccuracies. 206 | 207 | 3.5. Application of Additional Terms 208 | 209 | You may choose to offer, and to charge a fee for, warranty, support, 210 | indemnity or liability obligations to one or more recipients of Covered 211 | Software. However, You may do so only on Your own behalf, and not on behalf 212 | of any Contributor. You must make it absolutely clear that any such 213 | warranty, support, indemnity, or liability obligation is offered by You 214 | alone, and You hereby agree to indemnify every Contributor for any 215 | liability incurred by such Contributor as a result of warranty, support, 216 | indemnity or liability terms You offer. You may include additional 217 | disclaimers of warranty and limitations of liability specific to any 218 | jurisdiction. 219 | 220 | 4. Inability to Comply Due to Statute or Regulation 221 | 222 | If it is impossible for You to comply with any of the terms of this License 223 | with respect to some or all of the Covered Software due to statute, judicial 224 | order, or regulation then You must: (a) comply with the terms of this License 225 | to the maximum extent possible; and (b) describe the limitations and the code 226 | they affect. Such description must be placed in a text file included with all 227 | distributions of the Covered Software under this License. Except to the 228 | extent prohibited by statute or regulation, such description must be 229 | sufficiently detailed for a recipient of ordinary skill to be able to 230 | understand it. 231 | 232 | 5. Termination 233 | 234 | 5.1. The rights granted under this License will terminate automatically if You 235 | fail to comply with any of its terms. However, if You become compliant, 236 | then the rights granted under this License from a particular Contributor 237 | are reinstated (a) provisionally, unless and until such Contributor 238 | explicitly and finally terminates Your grants, and (b) on an ongoing basis, 239 | if such Contributor fails to notify You of the non-compliance by some 240 | reasonable means prior to 60 days after You have come back into compliance. 241 | Moreover, Your grants from a particular Contributor are reinstated on an 242 | ongoing basis if such Contributor notifies You of the non-compliance by 243 | some reasonable means, this is the first time You have received notice of 244 | non-compliance with this License from such Contributor, and You become 245 | compliant prior to 30 days after Your receipt of the notice. 246 | 247 | 5.2. If You initiate litigation against any entity by asserting a patent 248 | infringement claim (excluding declaratory judgment actions, counter-claims, 249 | and cross-claims) alleging that a Contributor Version directly or 250 | indirectly infringes any patent, then the rights granted to You by any and 251 | all Contributors for the Covered Software under Section 2.1 of this License 252 | shall terminate. 253 | 254 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user 255 | license agreements (excluding distributors and resellers) which have been 256 | validly granted by You or Your distributors under this License prior to 257 | termination shall survive termination. 258 | 259 | 6. Disclaimer of Warranty 260 | 261 | Covered Software is provided under this License on an “as is” basis, without 262 | warranty of any kind, either expressed, implied, or statutory, including, 263 | without limitation, warranties that the Covered Software is free of defects, 264 | merchantable, fit for a particular purpose or non-infringing. The entire 265 | risk as to the quality and performance of the Covered Software is with You. 266 | Should any Covered Software prove defective in any respect, You (not any 267 | Contributor) assume the cost of any necessary servicing, repair, or 268 | correction. This disclaimer of warranty constitutes an essential part of this 269 | License. No use of any Covered Software is authorized under this License 270 | except under this disclaimer. 271 | 272 | 7. Limitation of Liability 273 | 274 | Under no circumstances and under no legal theory, whether tort (including 275 | negligence), contract, or otherwise, shall any Contributor, or anyone who 276 | distributes Covered Software as permitted above, be liable to You for any 277 | direct, indirect, special, incidental, or consequential damages of any 278 | character including, without limitation, damages for lost profits, loss of 279 | goodwill, work stoppage, computer failure or malfunction, or any and all 280 | other commercial damages or losses, even if such party shall have been 281 | informed of the possibility of such damages. This limitation of liability 282 | shall not apply to liability for death or personal injury resulting from such 283 | party’s negligence to the extent applicable law prohibits such limitation. 284 | Some jurisdictions do not allow the exclusion or limitation of incidental or 285 | consequential damages, so this exclusion and limitation may not apply to You. 286 | 287 | 8. Litigation 288 | 289 | Any litigation relating to this License may be brought only in the courts of 290 | a jurisdiction where the defendant maintains its principal place of business 291 | and such litigation shall be governed by laws of that jurisdiction, without 292 | reference to its conflict-of-law provisions. Nothing in this Section shall 293 | prevent a party’s ability to bring cross-claims or counter-claims. 294 | 295 | 9. Miscellaneous 296 | 297 | This License represents the complete agreement concerning the subject matter 298 | hereof. If any provision of this License is held to be unenforceable, such 299 | provision shall be reformed only to the extent necessary to make it 300 | enforceable. Any law or regulation which provides that the language of a 301 | contract shall be construed against the drafter shall not be used to construe 302 | this License against a Contributor. 303 | 304 | 305 | 10. Versions of the License 306 | 307 | 10.1. New Versions 308 | 309 | Mozilla Foundation is the license steward. Except as provided in Section 310 | 10.3, no one other than the license steward has the right to modify or 311 | publish new versions of this License. Each version will be given a 312 | distinguishing version number. 313 | 314 | 10.2. Effect of New Versions 315 | 316 | You may distribute the Covered Software under the terms of the version of 317 | the License under which You originally received the Covered Software, or 318 | under the terms of any subsequent version published by the license 319 | steward. 320 | 321 | 10.3. Modified Versions 322 | 323 | If you create software not governed by this License, and you want to 324 | create a new license for such software, you may create and use a modified 325 | version of this License if you rename the license and remove any 326 | references to the name of the license steward (except to note that such 327 | modified license differs from this License). 328 | 329 | 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses 330 | If You choose to distribute Source Code Form that is Incompatible With 331 | Secondary Licenses under the terms of this version of the License, the 332 | notice described in Exhibit B of this License must be attached. 333 | 334 | Exhibit A - Source Code Form License Notice 335 | 336 | This Source Code Form is subject to the 337 | terms of the Mozilla Public License, v. 338 | 2.0. If a copy of the MPL was not 339 | distributed with this file, You can 340 | obtain one at 341 | http://mozilla.org/MPL/2.0/. 342 | 343 | If it is not possible or desirable to put the notice in a particular file, then 344 | You may include the notice in a location (such as a LICENSE file in a relevant 345 | directory) where a recipient would be likely to look for such a notice. 346 | 347 | You may add additional accurate notices of copyright ownership. 348 | 349 | Exhibit B - “Incompatible With Secondary Licenses” Notice 350 | 351 | This Source Code Form is “Incompatible 352 | With Secondary Licenses”, as defined by 353 | the Mozilla Public License, v. 2.0. 354 | 355 | --------------------------------------------------------------------------------