Locked OmegaT Team Project (SVN)

Situation

One of the translators involved in a team translation project using a very cool OmegaT Team project feature gets a message about the project being locked.

16

Problem

The translator’s connectivity is rather limited and re-downloading the whole project would be very undesirable. There’s also no SVN software installed on her computer (other than OmegaT itself). Otherwise the quickest solution would be either getting OmegaT to download the project anew into an empty folder, or run “svn cleanup” on the project’s folder using one of the available SVN tools. Bad luck this time.

Solution

Since OmegaT can act as a SVN client itself (that’s what it does when a Team project is loaded), and there’s a cool scripting functionality, why not just exploit OmegaT to do the cleanup on any folder of our choice? So, here’s the script (the heading is also a link):

  • svn_cleanup_selected.groovy

    /*
     * Perform SVN cleanup on any local SVN repository
     *
     * @author	Yu Tang
     * @author	Kos Ivatsov
     * @date	2014-01-17
     * @version	0.2
     */
    
    import javax.swing.JFileChooser
    import org.omegat.core.team.SVNRemoteRepository
    import org.tmatesoft.svn.core.wc.*
    
    def folder
    
    if (project.isProjectLoaded()) {
    	def prop = project.getProjectProperties()
    	folder = new File(prop.getProjectRoot())
    	}else{
    	JFileChooser fc = new JFileChooser(
    		dialogTitle: "Choose SVN repository to perform cleanup",
    		fileSelectionMode: JFileChooser.DIRECTORIES_ONLY, 
    		multiSelectionEnabled: false
    		)
    	if(fc.showOpenDialog() != JFileChooser.APPROVE_OPTION) {
    		console.println "Canceled"
    		return
    		}
    	folder = new File(fc.getSelectedFile().toString())
    	}
    
    if (SVNRemoteRepository.isSVNDirectory(folder)) { 
    	def clientManager = SVNClientManager.newInstance()
    	clientManager.getWCClient().doCleanup(folder)
    	console.println("Cleanup done!!")
    	}
    return
    

    If that pesky message pops up, it should usually suffice to fire up the script (it works even if no project is currently loaded, otherwise it cleans up the current project if it happens to be a Team project), browse to the problematic project folder and get “Cleanup done!!” message in the Scripting console. After that, the project should open without problems.

    After the fix there might be a problem with sync, and OmegaT may throw a message like this:

    sync problem

    but that is usually easily fixed with Ctrl+S (Save) or F5 (Reload).

I wish you all good and stable Internet connection, responsive and responsible team members and a glitch-less work-flow.

But as of now,

Good luck

UPDATE:

The script is now bundled with OmegaT, you’ll get it along with the program. No need to download it from the links posted here.

Advertisements

Convert OmegaT project to XLIFF for other CAT tools

I’m back with another little script that might be pretty handy for those who need to work on the same material in different CAT tools, or for translation agencies who use OmegaT as their main CAT application but farm out the work to translators using their CAT tools of choice. As a matter of fact, the script was requested by translation agency Velior for this very reason.
When the script is invoked, it writes out a file named PROJECTNAME.xlf (PROJECTNAME is the actual name of the project, not this loudly yelled word, of course), and the file is located in script_output subfolder of the current project. It exports both translated (they get “final” state in the resultant XLF file) and untranslated segments, and for untranslated segments the source is copied to the target, and such segments get “needs-translation” state. OmegaT segmentation and tags are preserved. Tags get enveloped in <ph id=”x”> and </ph>, so that they are treated as tags in other CAT tools. Continue reading