Sage.ResourceManagement.ResourceManager.GetPhrase C# (CSharp) Method

GetPhrase() private method

Gets the dictionary phrase with the specified id, for the current category, in the current locale.
/// is null. ///
private GetPhrase ( string phraseId ) : string
phraseId string The id of the phrase to get.
return string
        internal string GetPhrase(string phraseId)
        {
            if (string.IsNullOrEmpty(phraseId))
                throw new ArgumentNullException("phraseId");

            phraseId = string.Concat(context.Category, ".", phraseId);

            DictionaryFileCollection dictionaries = Internationalizer.GetTranslationDictionaryCollection(context);
            if (!dictionaries.Locales.Contains(context.Locale))
            {
                log.ErrorFormat(
                    "The requested phrase '{0}' could not be retrieved because the current category '{1}' has no dictionary in the current locale '{2}'.",
                    phraseId, context.Category, context.Locale);

                return string.Format(MissingPhrasePlaceholder, phraseId);
            }

            var dictionary = dictionaries.Dictionaries[context.Locale];
            var phrases = dictionary.Items;
            if (!phrases.ContainsKey(phraseId))
            {
                log.ErrorFormat(
                    "The requested phrase '{0}' could not be retrieved because the dictionary for category '{1}' and locale '{2}' has not such phrase defined.",
                    phraseId, context.Category, context.Locale);

                return string.Format(MissingPhrasePlaceholder, phraseId);
            }

            return phrases[phraseId];
        }