public void TestBingTranslate() { var factory = new BingTranslateProviderFactory(); var key = "90ebd9b5e7544500a5c1cf3ff7996314"; var to = LanguageDef.BuildLangFromCulture("zh-CHS"); var provider = factory.CreateProvider(key, null, to); var lines = new[] { new ChattingLine { RawContent = "This is a testing string." }, new ChattingLine { RawContent = "This is another testing string." }, new ChattingLine { RawContent = "Wow lots of strings!" }, new ChattingLine { RawContent = "I like the game called 'Final Fantasy XIV'!" }, new ChattingLine { RawContent = "This is a string <aaa> contains html tag." }, new ChattingLine { RawContent = "This is a string < contains html tag." }, new ChattingLine { RawContent = "<" }, }.ToList(); provider.Translate(lines); }
public void TestYoudaoTranslate() { var factory = new YoudaoTranslateProviderFactory(); var to = LanguageDef.BuildLangFromCulture("zh-CHS"); var appId = "YOUR-APP-ID"; var secret = "YOUR-APP-SECRET"; var provider = factory.CreateProvider($"{appId}:{secret}", null, to); var lines = new[] { new ChattingLine { RawContent = "This is a testing string." }, new ChattingLine { RawContent = "This is another testing string." }, new ChattingLine { RawContent = "Wow lots of strings!" }, new ChattingLine { RawContent = "I like the game called 'Final Fantasy XIV'!" }, new ChattingLine { RawContent = "This is a string <aaa> contains html tag." }, new ChattingLine { RawContent = "This is a string < contains html tag." }, new ChattingLine { RawContent = "<" }, new ChattingLine { RawContent = "你在逗我呢?" }, }.Select(it => { provider.PreprocessLine(it); return(it); }).ToList(); provider.Translate(lines); }
public void TestUnofficialGoogleTranslate() { var factory = new GoogleTranslateProviderFactory(); var to = LanguageDef.BuildLangFromCulture("zh"); var provider = factory.CreateProvider(null, null, to); var lines = new[] { new ChattingLine { RawContent = "This is a testing string." }, new ChattingLine { RawContent = "This is another testing string." }, new ChattingLine { RawContent = "Wow lots of strings!" }, new ChattingLine { RawContent = "I like the game called 'Final Fantasy XIV'!" }, new ChattingLine { RawContent = "This is a string <aaa> contains html tag." }, new ChattingLine { RawContent = "This is a string < contains html tag." }, new ChattingLine { RawContent = "<" }, new ChattingLine { RawContent = "你在逗我呢?" }, }.Select(it => { provider.PreprocessLine(it); return(it); }).ToList(); provider.Translate(lines); }