Skip to content

Instantly share code, notes, and snippets.

@taktos
Created February 20, 2012 04:56
Show Gist options
  • Save taktos/1867928 to your computer and use it in GitHub Desktop.
Save taktos/1867928 to your computer and use it in GitHub Desktop.
findbugs japanese localization script for sonar-l10n-ja-plugin
def findbugs = new XmlParser().parse('http://findbugs.googlecode.com/svn/trunk/findbugs/etc/findbugs.xml')
def messages = new XmlParser().parse('http://findbugs.googlecode.com/svn/trunk/findbugs/etc/messages_ja.xml')
def dir = new File('findbugs_ja')
dir.mkdirs()
java.util.Properties prop = new Properties()
findbugs.BugPattern.each { bug->
def category = messages.BugCategory.find{ it['@category'] == bug['@category'] }.Description.text()
def msg = messages.BugPattern.find{ it['@type'] == bug['@type'] }
new File(dir, "${bug['@type']}.html").withWriter('utf-8') {
it.write(msg?.Details.text())
}
prop.setProperty("rule.findbugs.${bug['@type']}.name", "${category} - ${msg?.ShortDescription.text()}")
}
prop.store(new File('findbugs_ja.properties').newOutputStream(), 'l10n-ja-plugin')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment