/// ------------------------------------------------------------------------------------ /// <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() + ")"); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds the list of styles to dictionary. /// </summary> /// <param name="list">The list of style info (name and type of style).</param> /// <param name="capType">The reason this style should begin with a capital letter.</param> /// ------------------------------------------------------------------------------------ private void AddListToDictionary(List<StyleInfo> list, StyleCapInfo.CapCheckTypes capType) { foreach (StyleInfo styleInfo in list) { m_allCapitalizedStyles.Add(styleInfo.StyleName.Replace("_", " "), new StyleCapInfo(styleInfo.StyleType, capType)); } }