One of the complains OmegaT gets is impossibility to split and merge segments without editing projects’ or global segmentation rules. There were a few attempts to address the issue, but they required a third-party utility that would edit
segmentation.conf. One of the most recent attempt was Dimitry Prihodko’s Merge utility. If I understood it right, Dimitry asked Yu Tang to rework his thingy, and Yu Tang came up with a Groovy script that did all the merging using only OmegaT internals. It wasn’t limited to any OS or dependent on other tools (so much for hard Pascal coding, Dimitry). There was only a minor issue that the script couldn’t be used to split segments. And that’s what I’ve added and what I’m sharing here.
The script and its
.properties (only English and Russian so far) can be downloaded from SF.net.
The script works only with the project specific segmentation. When the script is invoked, it will try to split the current segment or merge it with the next. It will try to split the segment when there’s a selection in the current source that goes from the split point up to the end of the segment (right before the segment marker). If anything else is selected, even in the current source, it will be ignored and the merge with the next segment will be attempted.
So, in order to merge just run the script, and it will try to put the current and the next segments together. If a segment needs to be split, activate it, select the part that needs to become the next segment (till the very end), and run the script.
The script will show a confirm message with the perspective merge/split result, so it could be canceled. It will also prompt to reload the project, and that prompt was added because there might be a situation when several rules need to be added, and reloading after each of them would be a waste of time.
Of course, the script isn’t too universal, and if one joined two segments together and later wanted to split them, the chances are it won’t work as the added rules will clash. Or there might be a rule somewhere that is simply wider than the one just added, so the desired split or merge wouldn’t actually occur. And therefore from time to time one might need to call up Project properties and get their hands dirty with the rules.
All the credits go to Yu Tang for cool Groovy coding and Dimitry Prihodko for the idea and hard pushing. Any further help and/or comments are very welcome. If any of native English speakers wanted to edit the
.properties (somewhat hastily put together, sorry), that would be really awesome.
But as of now,