Search in sources :

Example 1 with HTMLOptions

use of org.omegat.filters2.html2.HTMLOptions in project omegat by omegat-org.

the class TmxComplianceTests method testExport2A.

/**
 * Test Export2A - HTML
 */
@Test
public void testExport2A() throws Exception {
    File tmxFile = new File("test/data/tmx/TMXComplianceKit/ExportTest2A.tmx");
    File sourceFile = new File("test/data/tmx/TMXComplianceKit/ExportTest2A.htm");
    File translatedFile = new File("test/data/tmx/TMXComplianceKit/ExportTest2A_fr.htm");
    ProjectProperties props = new TestProjectProperties("EN-US", "FR-CA");
    props.setSentenceSegmentingEnabled(true);
    FilterContext fc = new FilterContext(props);
    fc.setInEncoding("windows-1252");
    Map<String, String> config = new TreeMap<String, String>();
    new HTMLOptions(config).setSkipMeta("content=en-us,content=fr-ca");
    List<String> sources = loadTexts(new HTMLFilter2(), sourceFile, null, fc, config);
    List<String> translations = loadTexts(new HTMLFilter2(), translatedFile, null, fc, config);
    assertEquals(sources.size(), translations.size());
    ProjectTMX tmx = new ProjectTMX(props.getSourceLanguage(), props.getTargetLanguage(), props.isSentenceSegmentingEnabled(), outFile, orphanedCallback);
    for (int i = 0; i < sources.size(); i++) {
        tmx.defaults.put(sources.get(i), createTMXEntry(sources.get(i), translations.get(i), true));
    }
    tmx.exportTMX(props, outFile, false, true, true);
    compareTMX(tmxFile, outFile, 12);
}
Also used : HTMLOptions(org.omegat.filters2.html2.HTMLOptions) TreeMap(java.util.TreeMap) HTMLFilter2(org.omegat.filters2.html2.HTMLFilter2) File(java.io.File) FilterContext(org.omegat.filters2.FilterContext) Test(org.junit.Test)

Example 2 with HTMLOptions

use of org.omegat.filters2.html2.HTMLOptions in project omegat by omegat-org.

the class TmxComplianceTests method testExport1B.

/**
 * Test Export1B - HTML
 */
@Test
public void testExport1B() throws Exception {
    File tmxFile = new File("test/data/tmx/TMXComplianceKit/ExportTest1B.tmx");
    File sourceFile = new File("test/data/tmx/TMXComplianceKit/ExportTest1B.htm");
    File translatedFile = new File("test/data/tmx/TMXComplianceKit/ExportTest1B_fr.htm");
    ProjectProperties props = new TestProjectProperties("EN-US", "FR-CA");
    FilterContext fc = new FilterContext(props);
    fc.setInEncoding("windows-1252");
    Map<String, String> config = new TreeMap<String, String>();
    new HTMLOptions(config).setSkipMeta("content=en-us,content=fr-ca");
    List<String> sources = loadTexts(new HTMLFilter2(), sourceFile, null, fc, config);
    List<String> translations = loadTexts(new HTMLFilter2(), translatedFile, null, fc, config);
    assertEquals(sources.size(), translations.size());
    ProjectTMX tmx = new ProjectTMX(props.getSourceLanguage(), props.getTargetLanguage(), props.isSentenceSegmentingEnabled(), outFile, orphanedCallback);
    for (int i = 0; i < sources.size(); i++) {
        tmx.defaults.put(sources.get(i), createTMXEntry(sources.get(i), translations.get(i), true));
    }
    tmx.exportTMX(props, outFile, false, false, true);
    compareTMX(tmxFile, outFile, 2);
}
Also used : HTMLOptions(org.omegat.filters2.html2.HTMLOptions) TreeMap(java.util.TreeMap) HTMLFilter2(org.omegat.filters2.html2.HTMLFilter2) File(java.io.File) FilterContext(org.omegat.filters2.FilterContext) Test(org.junit.Test)

Aggregations

File (java.io.File)2 TreeMap (java.util.TreeMap)2 Test (org.junit.Test)2 FilterContext (org.omegat.filters2.FilterContext)2 HTMLFilter2 (org.omegat.filters2.html2.HTMLFilter2)2 HTMLOptions (org.omegat.filters2.html2.HTMLOptions)2