Example #1
0
        public string Translate(string key, string text, params object[] args)
        {
            if (IsDefault == true)
            {
                if (TranslationsLookup.ContainsKey(key) == false)
                {
                    TranslationsLookup[key] = text;
                }
            }
            if (TranslationsLookup.ContainsKey(key) == true)
            {
                string data = TranslationsLookup[key];
                return(String.Format(data, args));
            }
            switch (MissingKeyHandling)
            {
            case MissingHandlingEnum.DefaultString:
            {
                if (TranslationsLookup.ContainsKey("internal/default") == true)
                {
                    return(String.Format(TranslationsLookup["internal/default"], key));
                }
                else
                {
                    return(String.Format(text, args));
                }
            }

            case MissingHandlingEnum.OutputKey:
                return(key);
            }
            return(String.Format(text, args));
        }
Example #2
0
 public string Lookup(string key)
 {
     if (TranslationsLookup.ContainsKey(key) == true)
     {
         return(TranslationsLookup[key]);
     }
     return(null);
 }