Esempio n. 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void StoreFoundPairToken(ITextToken tok, int i)
        {
            TextTokenSubstring tts = new TextTokenSubstring(tok, i, 1);

            // Assign an initial, default message which may be changed later
            tts.Message = m_checksDataSource.GetLocalizedString("Unmatched punctuation");
            m_pairTokensFound.Add(tts);
        }
Esempio n. 2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the error message given the style's reason for capitalization.
        /// </summary>
        /// <param name="dataSource">The data source.</param>
        /// <param name="capReasonType">Reason why a character should have been capitalized.</param>
        /// <param name="styleName">Name of the style or string.Empty if not relevant.</param>
        /// <returns>error message.</returns>
        /// ------------------------------------------------------------------------------------
        internal static string GetErrorMessage(IChecksDataSource dataSource,
                                               StyleCapInfo.CapCheckTypes capReasonType, string styleName)
        {
            switch (capReasonType)
            {
            case StyleCapInfo.CapCheckTypes.SentenceInitial:
                return(dataSource.GetLocalizedString("Sentence should begin with a capital letter"));

            case StyleCapInfo.CapCheckTypes.Heading:
                return(dataSource.GetLocalizedString("Heading should begin with a capital letter"));

            case StyleCapInfo.CapCheckTypes.Title:
                return(dataSource.GetLocalizedString("Title should begin with a capital letter"));

            case StyleCapInfo.CapCheckTypes.List:
                return(dataSource.GetLocalizedString("List paragraphs should begin with a capital letter"));

            case StyleCapInfo.CapCheckTypes.Table:
                return(dataSource.GetLocalizedString("Table contents should begin with a capital letter"));

            case StyleCapInfo.CapCheckTypes.ProperNoun:
                return(dataSource.GetLocalizedString("Proper nouns should begin with a capital letter"));

            case StyleCapInfo.CapCheckTypes.Special:
                return(String.Format(dataSource.GetLocalizedString(
                                         "Text in the {0} style should begin with a capital letter"), styleName));
            }

            throw new Exception("Reason for capitalizing the style " + styleName +
                                " is not handled in GetErrorMessage (" + capReasonType.ToString() + ")");
        }
Esempio n. 3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Runs the Characters Scripture checks.
        /// </summary>
        /// <param name="toks">The Scripture tokens to check.</param>
        /// <param name="record">Method to record the error.</param>
        /// ------------------------------------------------------------------------------------
        public void Check(IEnumerable <ITextToken> toks, RecordErrorHandler record)
        {
            // This method is called in ScrChecksDataSource.cs - RunCheck(IScriptureCheck check)
            m_categorizer = m_checksDataSource.CharacterCategorizer;

            // Get parameters needed to run this check.
            GetParameters();

            // Find all invalid characters and place them in 'm_characterSequences'
            GetReferences(toks, string.Empty, true);

            foreach (TextTokenSubstring tts in m_characterSequences)
            {
                tts.Message = (tts.ToString().Length > 1) ?
                              m_checksDataSource.GetLocalizedString("Invalid or unknown character diacritic combination") :
                              m_checksDataSource.GetLocalizedString("Invalid or unknown character");

                record(new RecordErrorEventArgs(tts, CheckId));
            }
        }
Esempio n. 4
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the error message given the style's reason for capitalization.
		/// </summary>
		/// <param name="dataSource">The data source.</param>
		/// <param name="capReasonType">Reason why a character should have been capitalized.</param>
		/// <param name="styleName">Name of the style or string.Empty if not relevant.</param>
		/// <returns>error message.</returns>
		/// ------------------------------------------------------------------------------------
		internal static string GetErrorMessage(IChecksDataSource dataSource,
			StyleCapInfo.CapCheckTypes capReasonType, string styleName)
		{
			switch (capReasonType)
			{
				case StyleCapInfo.CapCheckTypes.SentenceInitial:
					return dataSource.GetLocalizedString("Sentence should begin with a capital letter");
				case StyleCapInfo.CapCheckTypes.Heading:
					return dataSource.GetLocalizedString("Heading should begin with a capital letter");
				case StyleCapInfo.CapCheckTypes.Title:
					return dataSource.GetLocalizedString("Title should begin with a capital letter");
				case StyleCapInfo.CapCheckTypes.List:
					return dataSource.GetLocalizedString("List paragraphs should begin with a capital letter");
				case StyleCapInfo.CapCheckTypes.Table:
					return dataSource.GetLocalizedString("Table contents should begin with a capital letter");
				case StyleCapInfo.CapCheckTypes.ProperNoun:
					return dataSource.GetLocalizedString("Proper nouns should begin with a capital letter");
				case StyleCapInfo.CapCheckTypes.Special:
					return String.Format(dataSource.GetLocalizedString(
						"Text in the {0} style should begin with a capital letter"), styleName);
			}

			throw new Exception("Reason for capitalizing the style " + styleName +
				" is not handled in GetErrorMessage (" + capReasonType.ToString() + ")");
		}
Esempio n. 5
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Returns a localized version of the specified string.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 private string Localize(string strToLocalize)
 {
     return(m_checksDataSource.GetLocalizedString(strToLocalize));
 }