Skip to content

Instantly share code, notes, and snippets.

@epgarcia
Created April 29, 2015 09:13
Show Gist options
  • Save epgarcia/a51337cf456ab13673d6 to your computer and use it in GitHub Desktop.
Save epgarcia/a51337cf456ab13673d6 to your computer and use it in GitHub Desktop.
language-properties.groovy
def languageFolder = new File("/Users/myuser/Liferay/trunk/portal/modules/apps/site-navigation/site-navigation-breadcrumb-web/src/content/")
def languageSource = new File(languageFolder, "Language.properties")
def sourceKeys = []
languageSource.eachLine { line ->
sourceKeys.add(line.split("=")[0])
}
def sourceLanguages = new File("/Users/myuser/Liferay/trunk/portal/portal-impl/src/content")
def p = ~/.*_.*.properties/
println sourceKeys
sourceLanguages.eachFileMatch(p) { file ->
def targetFile = new File(languageFolder, file.name)
file.eachLine { line ->
if (!line.startsWith('#') && line != "") {
def values = line.split("=")
def key = values[0]
def value = values[1]
if (sourceKeys.contains(key)) {
targetFile << "${key}=${value}\n"
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment