Example #1
0
        public async Task <bool> CheckAllFiles(string finalLanguage, string originalLanguage)
        {
            var pathes = new List <string>();

            foreach (string path in Directory.EnumerateFiles(localPath, "*.html", SearchOption.AllDirectories))
            {
                pathes.Add(path);
            }
            foreach (string path in pathes)
            {
                var words = HtmlParser.GetWordsFromFile(path);

                var translatedTexts = new List <TranslatedText>();

                foreach (string word in words)
                {
                    var translated = await Translator.Translate(word, finalLanguage, originalLanguage);

                    translatedTexts.Add(translated);
                }

                FileEditor.ReplaceTextInFile(path, translatedTexts);
            }
            return(true);
        }