Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
2015OmegaT/OmegaT/scripts/modify_segment.groovy
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
18 lines (13 sloc)
625 Bytes
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
// :name=Example - Modify Segment :description=Example of segment modification | |
def ste = editor.currentEntry; | |
if (ste .srcText != "enu" ) | |
{ | |
target = project.getTranslationInfo(ste)?.translation; | |
//project.setTranslation(currentSegment, "FRA", true); | |
console.println(editor.currentEntryNumber + "\t" + ste.srcText ); | |
console.println(target); // In-memory target, the edited text is not available. | |
// See http://groovy.codehaus.org/Regular+Expressions for Groovy RegExp subtelties. | |
target = target.replaceAll(/(\d+),(\d+)/, '$1 $2'); | |
editor.replaceEditText(target); | |
editor.nextEntry(); | |
} |