use of org.omegat.core.segmentation.Segmenter in project omegat by omegat-org.
the class RealProject method createProject.
/**
* Create new project.
*/
public void createProject() {
Log.logInfoRB("LOG_DATAENGINE_CREATE_START");
UIThreadsUtil.mustNotBeSwingThread();
try {
if (!lockProject()) {
throw new KnownException("PROJECT_LOCKED");
}
createDirectory(config.getProjectRoot(), null);
createDirectory(config.getProjectInternal(), OConsts.DEFAULT_INTERNAL);
createDirectory(config.getSourceRoot(), OConsts.DEFAULT_SOURCE);
createDirectory(config.getGlossaryRoot(), OConsts.DEFAULT_GLOSSARY);
createDirectory(config.getTMRoot(), OConsts.DEFAULT_TM);
createDirectory(config.getTMAutoRoot(), OConsts.AUTO_TM);
createDirectory(config.getDictRoot(), OConsts.DEFAULT_DICT);
createDirectory(config.getTargetRoot(), OConsts.DEFAULT_TARGET);
// createDirectory(m_config.getTMOtherLangRoot(), OConsts.DEFAULT_OTHERLANG);
saveProjectProperties();
// Set project specific segmentation rules if they exist, or
// defaults otherwise.
SRX srx = config.getProjectSRX();
Core.setSegmenter(new Segmenter(srx == null ? Preferences.getSRX() : srx));
loadTranslations();
setProjectModified(true);
saveProject(false);
loadSourceFiles();
allProjectEntries = Collections.unmodifiableList(allProjectEntries);
importHandler = new ImportFromAutoTMX(this, allProjectEntries);
importTranslationsFromSources();
loadTM();
loadOtherLanguages();
loaded = true;
// clear status message
Core.getMainWindow().showStatusMessageRB(null);
} catch (Exception e) {
// trouble in tinsletown...
Log.logErrorRB(e, "CT_ERROR_CREATING_PROJECT");
Core.getMainWindow().displayErrorRB(e, "CT_ERROR_CREATING_PROJECT");
}
Log.logInfoRB("LOG_DATAENGINE_CREATE_END");
}
use of org.omegat.core.segmentation.Segmenter in project omegat by omegat-org.
the class TestTeamIntegration method main.
public static void main(String[] args) throws Exception {
String startVersion = prepareRepo();
Run[] runs = new Run[THREADS.length];
for (int i = 0; i < THREADS.length; i++) {
runs[i] = new Run(THREADS[i], new File(DIR, THREADS[i]), MAX_DELAY_SECONDS);
}
for (int i = 0; i < THREADS.length; i++) {
runs[i].start();
}
boolean alive;
do {
alive = false;
for (int i = 0; i < THREADS.length; i++) {
if (runs[i].finished) {
if (runs[i].result != 200) {
for (Run r : runs) {
r.end();
}
System.err.println("==================== EXIT BY ERROR ====================");
System.exit(1);
}
} else {
alive = true;
}
}
Thread.sleep(500);
} while (alive);
repo = createRepo2(REPO, new File(DIR, "repo"));
repo.update();
System.err.println("Check repo");
TestPreferencesInitializer.init();
Core.setSegmenter(new Segmenter(SRX.getDefault()));
checkRepo(startVersion);
System.err.println("Processed successfully");
}
use of org.omegat.core.segmentation.Segmenter in project omegat by omegat-org.
the class AutoTmxTest method setUp.
@Before
public final void setUp() throws Exception {
TestPreferencesInitializer.init();
Core.setSegmenter(new Segmenter(SRX.getDefault()));
}
use of org.omegat.core.segmentation.Segmenter in project omegat by omegat-org.
the class TmxSegmentationTest method setUp.
@Before
public final void setUp() throws Exception {
TestPreferencesInitializer.init();
Core.setSegmenter(new Segmenter(SRX.getDefault()));
}
use of org.omegat.core.segmentation.Segmenter in project omegat by omegat-org.
the class AlignerTest method setUp.
@Before
public final void setUp() {
FilterMaster.setFilterClasses(Arrays.asList(TextFilter.class, ResourceBundleFilter.class));
Core.setFilterMaster(new FilterMaster(FilterMaster.createDefaultFiltersConfig()));
Core.setSegmenter(new Segmenter(SRX.getDefault()));
assertTrue(Core.getFilterMaster().isFileSupported(new File("blah.txt"), true));
assertTrue(Core.getFilterMaster().isFileSupported(new File("blah.properties"), true));
}
Aggregations