Beispiel #1
0
        private async Task TranslateBatchesParallelly(IEnumerable <IList <XmlNode> > batches,
                                                      DivinityLocalizationLogger logger, Action batchFinished)
        {
            foreach (var batchNode in batches)
            {
                var tasks = batchNode.Select(x => TranslateContent(x, logger));
                await Task.WhenAll(tasks);

                batchFinished();
            }
        }
Beispiel #2
0
        public async Task TranslateAll(Action batchFinished)
        {
            var contents = _document.SelectNodes("contentList/content")
                           .Cast <XmlNode>()
                           .ToList();

            var logger  = new DivinityLocalizationLogger(contents.Count);
            var batches = contents.SplitIntoListsOfGivenSize(_parallelTranslations);

            await TranslateBatchesParallelly(batches, logger, batchFinished);
        }
        private async Task ApplyThePortugueseOnes(IEnumerable <IList <XmlNode> > batches,
                                                  DivinityLocalizationLogger logger, Action batchFinished)
        {
            foreach (var batchNode in batches)
            {
                var tasks = batchNode.Select(x => ApplyWhenContentIsPortugueseLogging(x, logger));
                await Task.WhenAll(tasks);

                batchFinished();
            }
        }
        public async Task Apply(Action batchFinished)
        {
            var contents = _manualTranslations.SelectNodes("contentList/content")
                           .Cast <XmlNode>()
                           .ToList();

            var logger  = new DivinityLocalizationLogger(contents.Count);
            var batches = contents.SplitIntoListsOfGivenSize(_parallelTranslations);

            await ApplyThePortugueseOnes(batches, logger, batchFinished);
        }
Beispiel #5
0
        private async Task TranslateContent(XmlNode content, DivinityLocalizationLogger logger)
        {
            await TranslateContentIfNeeded(content);

            logger.LogTranslationDone();
        }
        private async Task ApplyWhenContentIsPortugueseLogging(XmlNode content, DivinityLocalizationLogger logger)
        {
            await ApplyWhenContentIsPortuguese(content);

            logger.LogTranslationDone();
        }