use of org.omegat.filters2.IAlignCallback in project omegat by omegat-org.
the class MagentoFilterTest method testAlign.
@Test
public void testAlign() throws Exception {
final AlignResultHolder alignResult = new AlignResultHolder();
align(new MagentoFilter(), "magento/MagentoFilterAlign.csv", "magento/MagentoFilterAlign-tr.csv", new IAlignCallback() {
public void addTranslation(String id, String source, String translation, boolean isFuzzy, String comment, IFilter filter) {
alignResult.aligned = id.equals("code") && source.equals("original") && translation.equals("translated");
}
});
assertTrue(alignResult.aligned);
}
use of org.omegat.filters2.IAlignCallback in project omegat by omegat-org.
the class ResourceBundleFilterTest method testAlign.
@Test
public void testAlign() throws Exception {
final AlignResult ar = new AlignResult();
align(new ResourceBundleFilter(), "resourceBundle/file-ResourceBundleFilter.properties", "resourceBundle/file-ResourceBundleFilter_be.properties", new IAlignCallback() {
public void addTranslation(String id, String source, String translation, boolean isFuzzy, String path, IFilter filter) {
ar.found = id.equals("ID") && source.equals("Value") && translation.equals("test");
}
});
assertTrue(ar.found);
}
use of org.omegat.filters2.IAlignCallback in project omegat by omegat-org.
the class ILIASFilterTest method testAlign.
@Test
public void testAlign() throws Exception {
final AlignResultHolder alignResult = new AlignResultHolder();
align(new ILIASFilter(), "ilias/ILIASFilterAlign.lang", "ilias/ILIASFilterAlign-tr.lang", new IAlignCallback() {
@Override
public void addTranslation(String id, String source, String translation, boolean isFuzzy, String comment, IFilter filter) {
alignResult.aligned = id.equals("module_name#:#variable_name") && source.equals("original") && translation.equals("translated");
}
});
assertTrue(alignResult.aligned);
}
use of org.omegat.filters2.IAlignCallback in project omegat by omegat-org.
the class FilterMaster method alignFile.
public void alignFile(String sourceDir, String fileName, String targetdir, FilterContext fc, IAlignCallback alignCallback) throws Exception {
LookupInformation lookup = lookupFilter(new File(sourceDir, fileName), fc);
if (lookup == null) {
// Skip it
return;
}
File inFile = new File(sourceDir, fileName);
File outFile = new File(targetdir, getTargetForSource(fileName, lookup, fc.getTargetLang()));
if (!outFile.exists()) {
// out file not exist - skip
return;
}
fc.setInEncoding(lookup.outFilesInfo.getSourceEncoding());
fc.setOutEncoding(lookup.outFilesInfo.getTargetEncoding());
IFilter filterObject = lookup.filterObject;
try {
filterObject.alignFile(inFile, outFile, lookup.config, fc, alignCallback);
} catch (Exception ex) {
Log.log(ex);
}
}
Aggregations