// ******************************************************************************** /// <summary> /// /// </summary> /// <param name="resource"></param> /// <param name="checker"></param> /// <returns></returns> /// <created>UPh,29.11.2015</created> /// <changed>UPh,29.11.2015</changed> // ******************************************************************************** public override uint BeginCheckTokens(Pass.AddIn.Core.CPAIResource resource, Pass.AddIn.Core.CPAITokenCheck checker) { if (_AddInComponent == null) { _AddInComponent = AddInInstance as EasyTermAddInComponent; if (_AddInComponent == null) { return(0); } _TermBaseSet = _AddInComponent._TermBaseSet; if (_TermBaseSet == null) { return(0); } _Query = _TermBaseSet.Query; } bCheckTermUsage = false; bCheckProhibitedTerms = false; if (_Query == null) { return(0); } var stringlist = checker.GetStringList(); if (stringlist == null) { return(0); } var listinfo = stringlist.GetListInfo(); if (listinfo == null) { return(0); } checker.GetOption(PslConstant.TCO_CUSTOM_0, ref bCheckTermUsage); checker.GetOption(PslConstant.TCO_CUSTOM_1, ref bCheckProhibitedTerms); if (!bCheckProhibitedTerms && !bCheckTermUsage) { return(0); } _Query.SetLanguagePair(listinfo.Lang1, listinfo.Lang2); return(0); }
// ******************************************************************************** /// <summary> /// /// </summary> /// <param name="token"></param> /// <param name="resource"></param> /// <param name="checker"></param> /// <returns></returns> /// <created>UPh,29.11.2015</created> /// <changed>UPh,29.11.2015</changed> // ******************************************************************************** public override uint CheckToken(CPAIToken token, Pass.AddIn.Core.CPAIResource resource, CPAITokenCheck checker) { if (!bCheckProhibitedTerms && !bCheckTermUsage) { return(0); } if (_Query == null) { return(0); } int nTranslated = (int)token.GetProperty(enmTokenProperties.StateTranslated); if (nTranslated == 0) { // Check source string string src = token.GetProperty(enmTokenProperties.Text, PropSelectionType.Source) as string; if (bCheckProhibitedTerms) { DoCheckProhibitedTerm(src, token, checker); } } else { // Check translation string string src = token.GetProperty(enmTokenProperties.Text, PropSelectionType.Source) as string; string trn = token.GetProperty(enmTokenProperties.Text, PropSelectionType.Target) as string; if (bCheckTermUsage) { DoCheckTermUsage(src, trn, token, checker); } if (bCheckProhibitedTerms) { DoCheckProhibitedTerm(trn, token, checker); } } return(0); }
// ******************************************************************************** /// <summary> /// /// </summary> /// <param name="resource"></param> /// <param name="checker"></param> /// <returns></returns> /// <created>UPh,29.11.2015</created> /// <changed>UPh,29.11.2015</changed> // ******************************************************************************** public override uint EndCheckTokens(Pass.AddIn.Core.CPAIResource resource, Pass.AddIn.Core.CPAITokenCheck checker) { return(0); }