Last active
November 19, 2015 20:16
-
-
Save yu-tang/1a81901e0ea46ce30759 to your computer and use it in GitHub Desktop.
Enumerate filtered segments.
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
console.println 'Enumerate filtered segments.' | |
def entries = project.allEntries | |
def filter = editor.filter ?: [allowed: {true}] | |
def found = entries.findAll { filter.allowed it } | |
// Do something for each SourceTextEntry here | |
found.each { | |
// get translation info | |
def info = project.getTranslationInfo(it) | |
console.println "\n#${it.entryNum()}\t${it.srcText}" | |
console.println "\t${info.translation}" | |
console.println info.defaultTranslation ? '\t- Default' : "\t- Alternative\n\t $it.key" // key has more detail | |
} | |
"${found.size()} segments found." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment