Пример #1
0
        private void UpdateFromLanguage(TranslationDictionary dictionary, ProjectItem projectItem, TranslationFile file)
        {
            if (String.Equals(".resx", Path.GetExtension(projectItem.FileName), StringComparison.OrdinalIgnoreCase))
                UpdateProjectItemState(dictionary, projectItem, file);

            foreach (var child in projectItem.Children)
            {
                UpdateFromLanguage(dictionary, child, file);
            }
        }
Пример #2
0
        private void UpdateProjectItemState(TranslationDictionary dictionary, ProjectItem projectItem, TranslationFile file)
        {
            if (projectItem == null)
                throw new ArgumentNullException("projectItem");

            var fileContents = FileContents.Load(
                this,
                projectItem,
                file != null ? file.FindFile(projectItem) : null
            );

            bool anyPending = false;

            foreach (var node in fileContents.Nodes)
            {
                if (
                    node.Source != node.OriginalSource ||
                    (!node.Hidden && node.Translated == null)
                ) {
                    anyPending = true;
                }

                if (node.Translated != null)
                    dictionary.Add(node.OriginalSource, node.Translated);
            }

            if (fileContents.Nodes.Count == 0)
                projectItem.State = ProjectItemState.Unknown;
            else
                projectItem.State = anyPending ? ProjectItemState.Incomplete : ProjectItemState.Complete;
        }
Пример #3
0
 public void UpdateProjectItemState(ProjectItem projectItem, TranslationFile file)
 {
     UpdateProjectItemState(Program.SolutionManager.CurrentSolution.Dictionary, projectItem, file);
 }