コード例 #1
0
        private void BuildDictionaryHierarchyTrees(IDictionary <string, ILocalizationDictionary> dictionaries, ILocalizationDictionary dictionary)
        {
            if (dictionary.Scope() == GlobalScope)
            {
                return;
            }

            var parentScope = string.IsNullOrEmpty(dictionary.GetParentScopeName())
                ? dictionaries[GlobalScope]
                : dictionaries[dictionary.GetParentScopeName()];

            dictionary.SetParentDictionary(parentScope);
        }
コード例 #2
0
        private void AddDictionaryToHierarchyTreesWithoutBuildTree(ILocalizationDictionary dictionary)
        {
            m_dictionaries.Add(dictionary);

            if (!m_dictionariesPerCultureAndScope.Keys.Contains(dictionary.CultureInfo()))
            {
                throw new DictionaryLoadException(string.Format(UnknownCultureException, dictionary.CultureInfo(), dictionary.Scope()));
            }

            var dictionariesPerCulture = m_dictionariesPerCultureAndScope[dictionary.CultureInfo()];

            dictionariesPerCulture.Add(dictionary.Scope(), dictionary);

            foreach (var scopeAlias in dictionary.ScopeAlias())
            {
                dictionariesPerCulture.Add(scopeAlias, dictionary);
            }
        }