Created
April 29, 2015 09:13
-
-
Save epgarcia/a51337cf456ab13673d6 to your computer and use it in GitHub Desktop.
language-properties.groovy
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
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