Skip to content

Instantly share code, notes, and snippets.

@mnaberez
Created February 19, 2012 18:51
Show Gist options
  • Save mnaberez/1865150 to your computer and use it in GitHub Desktop.
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
// ==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