use of net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean in project translationstudio8 by heartsome.
the class MatchViewPart method manualExecSimpleTranslation.
public void manualExecSimpleTranslation(int rowIndex, IXliffEditor editor, ISimpleMatcher simpleMatcher) {
if (rowIndex == -1) {
return;
}
// handler.getTransUnit(rowId);
TransUnitBean transUnit = editor.getRowTransUnitBean(rowIndex);
if (transUnit == null) {
return;
}
XLFHandler handler = editor.getXLFHandler();
if (handler == null) {
return;
}
IProject prj = null;
if (editor instanceof IEditorPart) {
IEditorPart p = (IEditorPart) editor;
FileEditorInput input = (FileEditorInput) p.getEditorInput();
prj = input.getFile().getProject();
}
if (prj == null) {
return;
}
String rowId = handler.getRowId(rowIndex);
TransUnitInfo2TranslationBean tuInfo = getTuInfoBean(transUnit, handler, rowId);
TranslationTaskData data = new TranslationTaskData(simpleMatcher, transUnit, tuInfo, editor, rowIndex, prj);
synchronized (manualTranslationTaskContainer) {
manualTranslationTaskContainer.pushTranslationTask(data);
manualTranslationTaskContainer.notify();
}
}
use of net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean in project translationstudio8 by heartsome.
the class MatchViewPart method getTuInfoBean.
private TransUnitInfo2TranslationBean getTuInfoBean(TransUnitBean transUnit, XLFHandler handler, String rowId) {
String srcFullText = transUnit.getSrcContent();
String srcPureText = transUnit.getSrcText();
if ("".equals(srcFullText.trim()) || "".equals(srcPureText.trim())) {
return null;
}
sourceColunmCellRenderer.setTuSrcText(srcFullText);
String srcLanguage = transUnit.getSrcLang();
String tgtLanguage = transUnit.getTgtLang();
tgtLanguage = handler.getNatTableColumnName().get("target");
Language srcLang = LocaleService.getLanguageConfiger().getLanguageByCode(srcLanguage);
Language tgtLang = LocaleService.getLanguageConfiger().getLanguageByCode(tgtLanguage);
if (srcLang.isBidi() || tgtLang.isBidi()) {
gridTable.setOrientation(SWT.RIGHT_TO_LEFT);
} else {
gridTable.setOrientation(SWT.LEFT_TO_RIGHT);
}
TransUnitInfo2TranslationBean tuInfoBean = new TransUnitInfo2TranslationBean();
tuInfoBean.setSrcFullText(srcFullText);
tuInfoBean.setSrcPureText(srcPureText);
tuInfoBean.setSrcLanguage(srcLanguage);
tuInfoBean.setTgtLangugage(tgtLanguage);
int contextSize = tmMatcher.getContextSize();
if (contextSize != 0) {
Map<String, String> context = handler.getTransUnitContext(rowId, contextSize);
tuInfoBean.setPreContext(context.get("x-preContext"));
tuInfoBean.setNextContext(context.get("x-nextContext"));
} else {
tuInfoBean.setPreContext("");
tuInfoBean.setNextContext("");
}
return tuInfoBean;
}
use of net.heartsome.cat.ts.tm.bean.TransUnitInfo2TranslationBean in project translationstudio8 by heartsome.
the class MatchViewPart method manualExecComplexTranslation.
public void manualExecComplexTranslation(int rowIndex, IXliffEditor editor, IComplexMatch complexMatcher) {
if (rowIndex == -1) {
return;
}
// handler.getTransUnit(rowId);
TransUnitBean transUnit = editor.getRowTransUnitBean(rowIndex);
if (transUnit == null) {
return;
}
XLFHandler handler = editor.getXLFHandler();
if (handler == null) {
return;
}
IProject prj = null;
if (editor instanceof IEditorPart) {
IEditorPart p = (IEditorPart) editor;
FileEditorInput input = (FileEditorInput) p.getEditorInput();
prj = input.getFile().getProject();
}
if (prj == null) {
return;
}
String rowId = handler.getRowId(rowIndex);
TransUnitInfo2TranslationBean tuInfo = getTuInfoBean(transUnit, handler, rowId);
TranslationTaskData data = new TranslationTaskData(complexMatcher, transUnit, tuInfo, editor, rowIndex, prj);
synchronized (manualTranslationTaskContainer) {
manualTranslationTaskContainer.pushTranslationTask(data);
manualTranslationTaskContainer.notify();
}
}
Aggregations