Example #1
0
        /// <summary>
        /// Generate the text for the specified message type,
        /// using a list of post-processing actions.
        /// Trying to generate a text for a message type for which
        /// no translation has been specificed will cause an exception.
        /// </summary>
        public string GenerateText(Types.Enums.MessageType msgType, List <Types.Enums.MessagePostProcessing> postProcessActions = null)
        {
            if (!_dictionary.ContainsKey(msgType))
            {
                throw new ArgumentException(nameof(GenerateText));
            }

            return(PostProcessText(_dictionary[msgType], postProcessActions));
        }
Example #2
0
        /// <summary>
        /// Set a translation of a specific message type.
        /// Trying to set the same translation twice will cause an exception.
        /// </summary>
        protected void SetTranslation(Types.Enums.MessageType msgType, string translation)
        {
            if (_dictionary.ContainsKey(msgType))
            {
                throw new ArgumentException(nameof(SetTranslation));
            }

            _dictionary.Add(msgType, translation);
        }
Example #3
0
 /// <summary>
 /// Generate the text for the specified message type,
 /// using a single post-processing action.
 /// </summary>
 public string GenerateText(Types.Enums.MessageType msgType, Types.Enums.MessagePostProcessing postProcessAction)
 {
     return(GenerateText(msgType, new List <Types.Enums.MessagePostProcessing> {
         postProcessAction
     }));
 }