feat(i18n): localize the GitHub and GitLab task surfaces (#2283)

Co-authored-by: Kandev Agent <agent@kandev.dev>
This commit is contained in:
João Salavisa
2026-08-05 15:14:26 +02:00
committed by GitHub
parent 56350ffc2b
commit 58eee5a314
57 changed files with 1572 additions and 467 deletions
+24 -17
View File
@@ -48,6 +48,7 @@ import {
import { useGitHubActionPresets } from "@/hooks/domains/github/use-github-action-presets";
import { useAllWorkflowSnapshots } from "@/hooks/domains/kanban/use-all-workflow-snapshots";
import { hasGitHubPersonalActor } from "@/lib/github-auth";
import { Trans, useTranslation } from "react-i18next";
type GitHubPageClientProps = {
workspaceId?: string;
@@ -57,10 +58,11 @@ type GitHubPageClientProps = {
};
function PageHeader({ onOpenMobileSidebar }: { onOpenMobileSidebar?: () => void }) {
const { t } = useTranslation();
return (
<PageTopbar
title="GitHub"
subtitle="Pull requests and issues across your repos."
subtitle={t("github:pullRequestsAndIssuesAcrossYour")}
icon={<IconBrandGithub className="h-4 w-4" />}
actions={
onOpenMobileSidebar && (
@@ -70,7 +72,7 @@ function PageHeader({ onOpenMobileSidebar }: { onOpenMobileSidebar?: () => void
onClick={onOpenMobileSidebar}
className="md:hidden cursor-pointer"
data-testid="github-mobile-menu-button"
aria-label="Open GitHub filters"
aria-label={t("github:openGithubFilters")}
>
<IconMenu2 className="h-4 w-4" />
</Button>
@@ -87,6 +89,7 @@ function NotAuthenticatedNotice({
workspaceId?: string;
personalRequired: boolean;
}) {
const { t } = useTranslation();
const settingsHref = workspaceId
? `/settings/workspace/${workspaceId}/integrations/github`
: "/settings/integrations/github";
@@ -94,24 +97,23 @@ function NotAuthenticatedNotice({
<Alert>
<AlertDescription>
{personalRequired
? "Connect your personal GitHub identity to see pull requests and issues assigned to you."
: "GitHub is not connected. Configure workspace automation with gh CLI or a personal access token."}{" "}
<Link href={settingsHref} className="underline font-medium cursor-pointer">
Open GitHub settings
</Link>{" "}
to see your pull requests and issues.
? t("github:connectYourPersonalGithubIdentityTo")
: t("github:githubIsNotConnectedConfigureWorkspace")}{" "}
<Trans i18nKey="github:openSettingsToSeePrsAndIssues">
<Link href={settingsHref} className="underline font-medium cursor-pointer" />
to see your pull requests and issues.
</Trans>
</AlertDescription>
</Alert>
);
}
function NoWorkspaceNotice() {
const { t } = useTranslation();
return (
<div className="px-6 py-3 border-b shrink-0">
<Alert>
<AlertDescription>
No workspace configured. Create a workspace first to start tasks from PRs/issues.
</AlertDescription>
<AlertDescription>{t("github:noWorkspaceConfiguredCreateAWorkspace")}</AlertDescription>
</Alert>
</div>
);
@@ -126,14 +128,15 @@ function resolveTitle(
saved: SavedPreset[],
prPresets: PresetOption[],
issuePresets: PresetOption[],
t: (key: string, values?: Record<string, unknown>) => string,
): string {
if (selection.source === "saved") {
return saved.find((p) => p.id === selection.id)?.label ?? "Saved query";
return saved.find((p) => p.id === selection.id)?.label ?? t("github:savedQueryFallback");
}
const presets = selection.kind === "pr" ? prPresets : issuePresets;
return (
presets.find((p) => p.value === selection.id)?.label ??
(selection.kind === "pr" ? "Pull requests" : "Issues")
(selection.kind === "pr" ? t("github:titlePullRequests") : t("github:titleIssues"))
);
}
@@ -325,6 +328,7 @@ function useSearchInteractionControls(
}
function useGitHubPageState(workspaceId: string | null, enabled: boolean) {
const { t } = useTranslation();
const { pr: resolvedPrPresets, issue: resolvedIssuePresets } =
useResolvedQueryPresets(workspaceId);
const {
@@ -374,8 +378,8 @@ function useGitHubPageState(workspaceId: string | null, enabled: boolean) {
repoFilter,
);
const title = useMemo(
() => resolveTitle(selection, savedPresets, resolvedPrPresets, resolvedIssuePresets),
[selection, savedPresets, resolvedPrPresets, resolvedIssuePresets],
() => resolveTitle(selection, savedPresets, resolvedPrPresets, resolvedIssuePresets, t),
[selection, savedPresets, resolvedPrPresets, resolvedIssuePresets, t],
);
const onSelect = useSidebarSelectionHandler({
@@ -492,6 +496,7 @@ export function GitHubPageClient({
steps,
repositories,
}: GitHubPageClientProps) {
const { t } = useTranslation();
const { status, loaded } = useGitHubStatus(workspaceId ?? null);
const authed = hasGitHubUserIdentity(status);
const [launchPayload, setLaunchPayload] = useState<LaunchPayload | null>(null);
@@ -525,7 +530,9 @@ export function GitHubPageClient({
return (
<div className="flex h-full min-h-0 w-full flex-col bg-background">
<PageHeader onOpenMobileSidebar={loaded && authed ? onOpenMobileSidebar : undefined} />
{!loaded && <div className="p-6 text-sm text-muted-foreground">Checking GitHub status…</div>}
{!loaded && (
<div className="p-6 text-sm text-muted-foreground">{t("github:checkingGithubStatus")}</div>
)}
{loaded && !authed && (
<div className="p-6 max-w-2xl">
<NotAuthenticatedNotice
@@ -550,7 +557,7 @@ export function GitHubPageClient({
data-testid="github-mobile-sidebar"
>
<SheetHeader className="px-4 pt-4 pb-2">
<SheetTitle>Filters</SheetTitle>
<SheetTitle>{t("github:filters")}</SheetTitle>
</SheetHeader>
<PresetsSidebar
selected={state.selection}