|
1 | | -import type { Locale } from "~/lib/language" |
| 1 | +import { consoleRoute, type Locale } from "~/lib/language" |
2 | 2 | import { desktopAssets, updateApi } from "~/lib/download" |
3 | 3 |
|
4 | 4 | // LEGACY REDIRECTS, every one to be removed later. Old URLs that outside links, bookmarks, scripts |
@@ -32,7 +32,7 @@ export function legacyRedirect(request: Legacy): Response | undefined { |
32 | 32 | // links (`/go` about 75k requests a day, `/zen` 46k). Exact paths only: /zen/v1/* and /zen/go/v1/* |
33 | 33 | // are the inference API, which a prefix match here would break. |
34 | 34 | const moved = (request.locale ? localizedMoves : moves).get(request.path.replace(/(.)\/$/, "$1")) |
35 | | - if (moved && read) return redirect(301, `${moved}${request.search}`) |
| 35 | + if (moved && read) return redirect(301, `${request.locale ? consoleRoute(request.locale, moved) : moved}${request.search}`) |
36 | 36 |
|
37 | 37 | // The legacy dashboard and its sign-in, now the Console. The V1 CLI's "create a key at /auth" and |
38 | 38 | // V1's usage-limit link /workspace/<id>/go (about 50k requests a day). |
@@ -83,7 +83,8 @@ const moves = new Map([ |
83 | 83 | ["/enterprise", "/console/enterprise"], |
84 | 84 | ]) |
85 | 85 |
|
86 | | -// The old site rendered these three pages in every language; their localized URLs follow them. |
| 86 | +// The old site rendered these three pages in every language; their localized URLs follow them, and a |
| 87 | +// non-English URL keeps its language in the Console page it redirects to. |
87 | 88 | const localizedMoves = new Map([ |
88 | 89 | ["/go", "/console/go"], |
89 | 90 | ["/zen", "/console/models"], |
|
0 commit comments