Example #1
0
        /// <summary>
        /// Runs the processor.
        ///
        /// </summary>
        /// <param name="args">The arguments.
        ///             </param>
        public void Process(GetTranslationArgs args)
        {
            Assert.ArgumentNotNull((object)args, "args");
            List <string> processedDomains = new List <string>();

            if (args.HasResult || Context.Site == null || string.IsNullOrEmpty(Context.Site.DictionaryDomain))
            {
                return;
            }
            this.Args     = args;
            this.Database = args.Options.Database ?? args.ContentDatabase;
            DictionaryDomain domain;

            if (!DictionaryDomain.TryParse(Context.Site.DictionaryDomain, this.Database, out domain) || domain == null)
            {
                return;
            }

            string result;

            if (this.TryGetTranslation(domain, processedDomains, out result) && result != null)
            {
                args.Result = result;
            }
            else if (EnableFallback)
            {
                if (this.TryTranslateTextByFallbackLanguage(args, domain, out result) && result != null)
                {
                    args.Result = result;
                }
            }
        }
Example #2
0
        public static DictionaryDomain GetDictionaryDomain(SiteContext site)
        {
            DictionaryDomain dictionary;

            DictionaryDomain.TryParse(site.DictionaryDomain, Context.Database, out dictionary);
            return(dictionary);
        }