fix(google): use stable translation endpoint

This commit is contained in:
xixu-me committed 2026-08-19 16:52:53 +08:00
1 parent 9edbbef5ad
commit d885923253
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -29,7 +29,7 @@ export async function translateWithGoogle(
// Construct the request to Google Translate's internal API
const googleApiUrl = new URL(
"https://translate.google.com/translate_a/single"
"https://translate.googleapis.com/translate_a/single"
);
googleApiUrl.searchParams.append("client", "gtx"); // Google Translate web client
googleApiUrl.searchParams.append(
+1 -1
View File
@@ -41,7 +41,7 @@ describe("Google Translate Service", () => {
expect(result.source_lang).toBe("EN");
expect(result.target_lang).toBe("ES");
expect(fetch).toHaveBeenCalledWith(
expect.stringContaining("translate.google.com"),
expect.stringContaining("translate.googleapis.com"),
expect.objectContaining({
method: "GET",
headers: expect.objectContaining({