Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * #Purpose: Write all unique untranslated segments to a file
- * #Files: Writes 'untranslated.txt' in the current project's root
- * #Details: http://wp.me/p3fHEs-4L
- *
- * @author Kos Ivantsov
- * @based on scripts by Yu Tang
- * @date 2013-06-25
- * @version 0.2
- */
- import static javax.swing.JOptionPane.*
- import static org.omegat.util.Platform.*
- // abort if a project is not opened yet
- def prop = project.projectProperties
- if (!prop) {
- final def title = 'Untranslated to File'
- final def msg = 'Please try again after you open a project.'
- showMessageDialog null, msg, title, INFORMATION_MESSAGE
- return
- }
- def folder = prop.projectRoot
- def fileloc = folder+'/untranslated.txt'
- writefile = new File(fileloc)
- writefile.write("", 'UTF-8')
- def count = 0
- project.projectFiles
- .each {
- //console.println "\n${it.filePath}"
- it.entries
- .findAll {!project.getTranslationInfo(it).isTranslated()}
- .each {count++; writefile.append "${it.srcText}\n",'UTF-8'}
- }
- console.println "\nUntranslated segments found: $count"
- count = 0
- def lines = writefile.readLines()
- uniqline = lines.unique()
- writefile.write("",'UTF-8')
- uniqline.each {
- writefile.append "$it\n\n",'UTF8';
- }
- console.println "Unique untranslated segments written to file: $uniqline.size"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement