Created
February 19, 2012 18:51
-
-
Save mnaberez/1865150 to your computer and use it in GitHub Desktop.
Userscript for Greasemonkey and Chrome to highlight and console.log Rails I18n missing translations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Highlight Rails I18n Missing Translations | |
// @namespace http://mikenaberezny.com | |
// @description Highlight and console.log missing translations from Rails I18n. | |
// @include * | |
// ==/UserScript== | |
// Rails I18n wraps missing translations in <span class="translation_missing"> | |
var elements = document.getElementsByClassName("translation_missing"); | |
// style that will be applied to those spans | |
var highlight = "background-color: #ffff00; color: #000000;" | |
for (var i = 0; i < elements.length; i++) { | |
var el = elements[i]; | |
if (el.nodeName != "SPAN") { continue; } | |
el.style.cssText = highlight; | |
console.log("Translation Missing: " + el.innerHTML); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment