コード例 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="TranslatablePhrase"/> class.
        /// </summary>
        /// <param name="phrase">The original phrase.</param>
        /// ------------------------------------------------------------------------------------
        public TranslatablePhrase(string phrase)
        {
            m_sOrigPhrase = phrase.Normalize(NormalizationForm.FormD);
            if (!String.IsNullOrEmpty(m_sOrigPhrase))
            {
                switch (m_sOrigPhrase[m_sOrigPhrase.Length - 1])
                {
                case '?': m_type = TypeOfPhrase.Question; break;

                case '.': m_type = TypeOfPhrase.StatementOrImperative; break;

                default: m_type = TypeOfPhrase.Unknown; break;
                }
                if (m_type == TypeOfPhrase.Unknown && m_sOrigPhrase.StartsWith(Question.kGuidPrefix))
                {
                    m_sOrigPhrase = string.Empty;
                    m_type        = TypeOfPhrase.NoEnglishVersion;
                }
            }
        }
コード例 #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="TranslatablePhrase"/> class.
        /// </summary>
        /// <param name="originalPhrase">The original phrase. (Possibly a user-added phrase, in
        /// which case it will be a GUID, prefaced by Question.kGuidPrefix) </param>
        /// <param name="modifiedPhrase">The modified phrase.</param>
        /// ------------------------------------------------------------------------------------
        public TranslatablePhrase(string originalPhrase, string modifiedPhrase)
        {
            OriginalPhrase = originalPhrase.Normalize(NormalizationForm.FormC);
            if (!IsNullOrEmpty(modifiedPhrase))
            {
                m_sModifiedPhrase = modifiedPhrase.Normalize(NormalizationForm.FormC);
            }
            if (!IsNullOrEmpty(OriginalPhrase))
            {
                switch (PhraseInUse[PhraseInUse.Length - 1])
                {
                case '?': m_type = TypeOfPhrase.Question; break;

                case '.': m_type = TypeOfPhrase.StatementOrImperative; break;

                default: m_type = TypeOfPhrase.Unknown; break;
                }
                if (m_type == TypeOfPhrase.Unknown && OriginalPhrase.StartsWith(Question.kGuidPrefix))
                {
                    OriginalPhrase = Empty;
                    m_type         = TypeOfPhrase.NoEnglishVersion;
                }
            }
        }
コード例 #3
0
        internal string FinalPunctuationForType(TypeOfPhrase type)
        {
            string p;

            return(m_finalPunct.TryGetValue(type, out p) ? p : string.Empty);
        }
コード例 #4
0
		internal string FinalPunctuationForType(TypeOfPhrase type)
		{
			string p;
			return m_finalPunct.TryGetValue(type, out p) ? p : string.Empty;
		}