Skip to content

Commit

Permalink
* 修复翻译目标修改不及时生效
Browse files Browse the repository at this point in the history
  • Loading branch information
MakesYT committed Feb 20, 2025
1 parent 0fe3eed commit 3076ebb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions KitopiaEx/Translate/TranslateWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ public TranslateWindowViewModel()
token = httpClient.GetStringAsync("https://edge.microsoft.com/translate/auth").Result;
httpClient.Dispose();
httpClient = new HttpClient();
httpClient.BaseAddress =
new Uri(
$"https://api-edge.cognitive.microsofttranslator.com/translate?from=&to={Translate.TranslateLangToName(TargetTranslateLang)}&api-version=3.0&includeSentenceLength=true");
httpClient.DefaultRequestHeaders.Add("authorization",$"Bearer {token}");
httpClient.DefaultRequestHeaders.Add("User-Agent","KitopiaEx/1.1.0");
}
Expand All @@ -43,7 +40,7 @@ private async Task TryTranslate()
});
var content = new StringContent(jsonArray.ToJsonString(), Encoding.UTF8, "application/json");

var text =await httpClient.PostAsync("",content).Result.Content.ReadAsStringAsync();
var text =await httpClient.PostAsync(new Uri($"https://api-edge.cognitive.microsofttranslator.com/translate?from=&to={Translate.TranslateLangToName(TargetTranslateLang)}&api-version=3.0&includeSentenceLength=true"),content).Result.Content.ReadAsStringAsync();


try
Expand Down

0 comments on commit 3076ebb

Please sign in to comment.