コード例 #1
0
 /// <param name="domain">A Domain name which will be used to execute requests</param>
 public GoogleTranslator(string domain = "translate.google.cn")
 {
     Address     = new Uri($"https://{domain}/translate_a/single");
     _generator  = new GoogleKeyTokenGenerator();
     _httpClient = new HttpClient();
     _httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(@"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36");
 }
コード例 #2
0
 /// <param name="domain">A Domain name which will be used to execute requests</param>
 public GoogleTranslator(string domain = "translate.google.cn")
 {
     Address     = new Uri($"https://{domain}/translate_a/single");
     _generator  = new GoogleKeyTokenGenerator();
     _httpClient = new HttpClient();
 }
コード例 #3
0
 /// <param name="domain">A Domain name which will be used to execute requests</param>
 public GoogleTranslator(string domain = "translate.google.com")
 {
     _address   = new Uri($"https://{domain}/translate_a/single");
     _generator = new GoogleKeyTokenGenerator();
 }