Beispiel #1
0
        // Returns the term that will actually be translated
        // its either the Term value in this class or the text of the label if there is no term
        public void GetFinalTerms(out string primaryTerm, out string secondaryTerm)
        {
            primaryTerm   = string.Empty;
            secondaryTerm = string.Empty;

            if (!HasTargetCache() && !FindTarget())
            {
                return;
            }


            // if either the primary or secondary term is missing, get them. (e.g. from the label's text and font name)
            if (mTarget != null && (string.IsNullOrEmpty(mTerm) || string.IsNullOrEmpty(mTermSecondary)))
            {
                if (mLocalizeTarget != null)
                {
                    mLocalizeTarget.GetFinalTerms(this, mTerm, mTermSecondary, out primaryTerm, out secondaryTerm);
                    primaryTerm = LocalizationManager.RemoveNonASCII(primaryTerm, false);
                }
            }

            // If there are values already set, go with those
            if (!string.IsNullOrEmpty(mTerm))
            {
                primaryTerm = mTerm;
            }

            if (!string.IsNullOrEmpty(mTermSecondary))
            {
                secondaryTerm = mTermSecondary;
            }

            if (primaryTerm != null)
            {
                primaryTerm = primaryTerm.Trim();
            }
            if (secondaryTerm != null)
            {
                secondaryTerm = secondaryTerm.Trim();
            }
        }
Beispiel #2
0
        // Returns the term that will actually be translated
        // its either the Term value in this class or the text of the label if there is no term
        public void GetFinalTerms(out string primaryTerm, out string secondaryTerm)
        {
            primaryTerm   = string.Empty;
            secondaryTerm = string.Empty;

            if (!FindTarget())
            {
                return;
            }


            // if either the primary or secondary term is missing, get them. (e.g. from the label's text and font name)
            if (mLocalizeTarget != null)
            {
                mLocalizeTarget.GetFinalTerms(this, mTerm, mTermSecondary, out primaryTerm, out secondaryTerm);
                primaryTerm = I2Utils.GetValidTermName(primaryTerm, false);
            }

            // If there are values already set, go with those
            if (!string.IsNullOrEmpty(mTerm))
            {
                primaryTerm = mTerm;
            }

            if (!string.IsNullOrEmpty(mTermSecondary))
            {
                secondaryTerm = mTermSecondary;
            }

            if (primaryTerm != null)
            {
                primaryTerm = primaryTerm.Trim();
            }
            if (secondaryTerm != null)
            {
                secondaryTerm = secondaryTerm.Trim();
            }
        }