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/check_same_segments.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35 lines (24 sloc)
871 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=QA - Identical Segments :description=Checks for identical segments (case sensitive). | |
* | |
* Test script taking inspiration from the tag validation class :) | |
*/ | |
console.println("Check for identical segments (case insensitive).\n"); | |
var segment_count = 0; | |
var files = project.getProjectFiles(); | |
for (var i = 0; i < files.size(); i++) | |
{ | |
var fi = files.get(i); | |
console.println(fi.filePath); | |
for (var j = 0; j < fi.entries.size(); j++) | |
{ | |
var ste = fi.entries.get(j); | |
var source = ste.getSrcText(); | |
var target = project.getTranslationInfo(ste) ? project.getTranslationInfo(ste).translation : null; | |
if ( source.equalsIgnoreCase(target) ) | |
{ | |
console.println(ste.entryNum() + "\t" + source + "\t" + target); | |
segment_count++; | |
} | |
} | |
} | |
console.println("Segments found: " + segment_count); | |