コード例 #1
0
        private static async Task StartApp(string inputPath, string outputPath, string manualTranslationsPath)
        {
            var loader                    = new XmlLoader();
            var document                  = loader.Load(inputPath);
            var manualTranslations        = loader.Load(manualTranslationsPath);
            var translator                = new Translator();
            var localizationManager       = new DivinityLocalizationTranslator(translator, document);
            var manualTranslationsApplier = new ManualTranslationsApplier(translator, manualTranslations, document);
            var fixer = new GeneralTranslationMistakesFixer(document);

            Console.WriteLine("Translating...");
            await localizationManager.TranslateAll(() => loader.Save(outputPath, document));

            Console.WriteLine("Applying manual translations...");
            await manualTranslationsApplier.Apply(() => loader.Save(outputPath, document));

            Console.WriteLine("Fixing general translation mistakes");
            fixer.FixAll();

            loader.Save(outputPath, document);
            Console.WriteLine("Finished...");
        }
コード例 #2
0
        private static async Task StartApp(string englishPath, string translatedPath, string outputPath)
        {
            Console.WriteLine("Initializing update...");
            var loader                = new XmlLoader();
            var englishDoc            = loader.Load(englishPath);
            var translatedDoc         = loader.Load(translatedPath);
            var needingTranslationDoc = CreateNeedingTranslationOnlyDoc(englishDoc, translatedDoc);
            var translator            = new Translator();
            var localizationManager   = new DivinityLocalizationTranslator(translator, needingTranslationDoc);
            var fixer = new UpdateMistakesFixer(needingTranslationDoc);

            Console.WriteLine("Translating new lines...");
            await localizationManager.TranslateAll(() => {});

            Console.WriteLine("Fixing general translation mistakes");
            fixer.FixAll();

            Console.WriteLine("Building final artifact...");
            var finalArtifact = CreateDocumentWithUnionOfTwo(needingTranslationDoc, translatedDoc);

            loader.Save(outputPath, finalArtifact);
            Console.WriteLine("Finished...");
        }