/// <summary>
        /// Loads the specified localization plugin.
        /// </summary>
        /// <param name="plugin">The localization plugin to load.</param>
        public static void LoadPlugin(ILocalizationPlugin plugin)
        {
            Contract.Require(plugin, nameof(plugin));

            var culture = plugin.Culture;

            if (culture != null)
            {
                var pluralityEvaluators = plugin.GetPluralityEvaluators();
                if (pluralityEvaluators != null)
                {
                    foreach (var evaluator in pluralityEvaluators)
                    {
                        RegisterPluralityEvaluatorForCulture(culture, evaluator);
                    }
                }

                var matchEvaluators = plugin.GetMatchEvaluators();
                if (matchEvaluators != null)
                {
                    foreach (var evaluator in matchEvaluators)
                    {
                        RegisterMatchEvaluatorForCulture(culture, evaluator.Name, evaluator.Evaluator);
                    }
                }
            }
            else
            {
                var language = plugin.Language;
                if (language != null)
                {
                    var pluralityEvaluators = plugin.GetPluralityEvaluators();
                    if (pluralityEvaluators != null)
                    {
                        foreach (var evaluator in pluralityEvaluators)
                        {
                            RegisterPluralityEvaluatorForLanguage(language, evaluator);
                        }
                    }

                    var matchEvaluators = plugin.GetMatchEvaluators();
                    if (matchEvaluators != null)
                    {
                        foreach (var evaluator in matchEvaluators)
                        {
                            RegisterMatchEvaluatorForLanguage(language, evaluator.Name, evaluator.Evaluator);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads the specified localization plugin.
        /// </summary>
        /// <param name="plugin">The localization plugin to load.</param>
        public static void LoadPlugin(ILocalizationPlugin plugin)
        {
            Contract.Require(plugin, nameof(plugin));

            var cultures = plugin.Cultures ?? new String[0];

            var pluralityEvaluators = plugin.GetPluralityEvaluators();

            if (pluralityEvaluators != null)
            {
                foreach (var evaluator in pluralityEvaluators)
                {
                    foreach (var culture in cultures)
                    {
                        RegisterPluralityEvaluator(culture, evaluator);
                    }
                }
            }

            var matchEvaluators = plugin.GetMatchEvaluators();

            if (matchEvaluators != null)
            {
                foreach (var evaluator in matchEvaluators)
                {
                    foreach (var culture in cultures)
                    {
                        RegisterMatchEvaluator(culture, evaluator.Name, evaluator.Evaluator);
                    }
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Loads the specified localization plugin.
        /// </summary>
        /// <param name="plugin">The localization plugin to load.</param>
        public static void LoadPlugin(ILocalizationPlugin plugin)
        {
            Contract.Require(plugin, "plugin");

            var cultures = plugin.Cultures ?? new String[0];

            var pluralityEvaluators = plugin.GetPluralityEvaluators();
            if (pluralityEvaluators != null)
            {
                foreach (var evaluator in pluralityEvaluators)
                {
                    foreach (var culture in cultures)
                        RegisterPluralityEvaluator(culture, evaluator);
                }
            }

            var matchEvaluators = plugin.GetMatchEvaluators();
            if (matchEvaluators != null)
            {
                foreach (var evaluator in matchEvaluators)
                {
                    foreach (var culture in cultures)
                        RegisterMatchEvaluator(culture, evaluator.Name, evaluator.Evaluator);
                }
            }
        }