Fix create PR gh helper i18n (vibe-kanban) (#1290)

* Perfect! I've successfully fixed all i18n issues for the Create PR GitHub helper. Here's a summary of what was completed:

## Summary

All i18n issues have been resolved! The `check-i18n.sh` script now passes with flying colors.

### Changes Made:

1. **Added translation keys to tasks.json** (all 4 languages: en, ja, ko, es):
   - `createPrDialog.title`: "Create GitHub Pull Request"
   - `createPrDialog.description`: Dialog description
   - `createPrDialog.titleLabel`, `titlePlaceholder`: PR title field
   - `createPrDialog.descriptionLabel`, `descriptionPlaceholder`: PR description field
   - `createPrDialog.baseBranchLabel`: Base branch selector
   - `createPrDialog.loadingBranches`, `selectBaseBranch`: Branch loading states
   - `createPrDialog.creating`, `createButton`: Submit button states
   - `createPrDialog.errors.*`: All error messages (insufficientPermissions, repoNotFoundOrNoAccess, failedToCreate)

2. **Updated CreatePRDialog.tsx**:
   - Changed `useTranslation()` to `useTranslation('tasks')` to specify namespace
   - Replaced all 14 hardcoded strings with `t('createPrDialog.*')` translation calls
   - Used `t('common:buttons.cancel')` for the cancel button

3. **Added integrations.github.cliSetup keys to settings.json** (all 4 languages):
   - Created new `integrations` namespace at root level
   - Added all GitHub CLI setup keys that were previously only in `settings.general.github`
   - This ensures the keys exist at both paths for backward compatibility

### Test Results:

 **No new literal strings introduced** - Actually removed 6 hardcoded strings!
 **No duplicate JSON keys found**
 **Translation keys are consistent across all locales** (en, ja, ko, es)

The implementation properly handles all error cases, dialog fields, and button states with proper i18n support across all 4 supported languages.

* Cleanup script changes for task attempt 30cf60d2-f2bc-443a-9c72-28b94962f155
This commit is contained in:
Alex Netsch
2025-11-14 17:24:23 +00:00
committed by Louis Knight-Webb
parent 1ff0395cdc
commit e1f69e2a9d
9 changed files with 227 additions and 21 deletions

View File

@@ -39,7 +39,7 @@ import type { GhCliSetupError } from 'shared/types';
import { useUserSystem } from '@/components/config-provider';
const CreatePrDialog = NiceModal.create(() => {
const modal = useModal();
const { t } = useTranslation();
const { t } = useTranslation('tasks');
const { isLoaded } = useAuth();
const { environment } = useUserSystem();
const data = modal.args as
@@ -188,19 +188,15 @@ const CreatePrDialog = NiceModal.create(() => {
return;
}
case GitHubServiceError.INSUFFICIENT_PERMISSIONS:
setError(
'Insufficient permissions. Please ensure the GitHub CLI has the necessary permissions.'
);
setError(t('createPrDialog.errors.insufficientPermissions'));
setGhCliHelp(null);
return;
case GitHubServiceError.REPO_NOT_FOUND_OR_NO_ACCESS:
setError(
'Repository not found or no access. Please check your repository access and ensure you are authenticated.'
);
setError(t('createPrDialog.errors.repoNotFoundOrNoAccess'));
setGhCliHelp(null);
return;
default:
setError(result.message || 'Failed to create GitHub PR');
setError(result.message || t('createPrDialog.errors.failedToCreate'));
setGhCliHelp(null);
return;
}
@@ -210,7 +206,7 @@ const CreatePrDialog = NiceModal.create(() => {
setError(result.message);
setGhCliHelp(null);
} else {
setError('Failed to create GitHub PR');
setError(t('createPrDialog.errors.failedToCreate'));
setGhCliHelp(null);
}
}, [data, prBaseBranch, prBody, prTitle, modal, isMacEnvironment]);
@@ -231,9 +227,9 @@ const CreatePrDialog = NiceModal.create(() => {
<Dialog open={modal.visible} onOpenChange={() => handleCancelCreatePR()}>
<DialogContent className="sm:max-w-[525px]">
<DialogHeader>
<DialogTitle>Create GitHub Pull Request</DialogTitle>
<DialogTitle>{t('createPrDialog.title')}</DialogTitle>
<DialogDescription>
Create a pull request for this task attempt on GitHub.
{t('createPrDialog.description')}
</DialogDescription>
</DialogHeader>
{!isLoaded ? (
@@ -243,34 +239,40 @@ const CreatePrDialog = NiceModal.create(() => {
) : (
<div className="space-y-4 py-4">
<div className="space-y-2">
<Label htmlFor="pr-title">Title</Label>
<Label htmlFor="pr-title">
{t('createPrDialog.titleLabel')}
</Label>
<Input
id="pr-title"
value={prTitle}
onChange={(e) => setPrTitle(e.target.value)}
placeholder="Enter PR title"
placeholder={t('createPrDialog.titlePlaceholder')}
/>
</div>
<div className="space-y-2">
<Label htmlFor="pr-body">Description (optional)</Label>
<Label htmlFor="pr-body">
{t('createPrDialog.descriptionLabel')}
</Label>
<Textarea
id="pr-body"
value={prBody}
onChange={(e) => setPrBody(e.target.value)}
placeholder="Enter PR description"
placeholder={t('createPrDialog.descriptionPlaceholder')}
rows={4}
/>
</div>
<div className="space-y-2">
<Label htmlFor="pr-base">Base Branch</Label>
<Label htmlFor="pr-base">
{t('createPrDialog.baseBranchLabel')}
</Label>
<BranchSelector
branches={branches}
selectedBranch={prBaseBranch}
onBranchSelect={setPrBaseBranch}
placeholder={
branchesLoading
? 'Loading branches...'
: 'Select base branch'
? t('createPrDialog.loadingBranches')
: t('createPrDialog.selectBaseBranch')
}
className={
branchesLoading ? 'opacity-50 cursor-not-allowed' : ''
@@ -296,7 +298,7 @@ const CreatePrDialog = NiceModal.create(() => {
)}
<DialogFooter>
<Button variant="outline" onClick={handleCancelCreatePR}>
Cancel
{t('common:buttons.cancel')}
</Button>
<Button
onClick={handleConfirmCreatePR}
@@ -306,10 +308,10 @@ const CreatePrDialog = NiceModal.create(() => {
{creatingPR ? (
<>
<Loader2 className="mr-2 h-4 w-4 animate-spin" />
Creating...
{t('createPrDialog.creating')}
</>
) : (
'Create PR'
t('createPrDialog.createButton')
)}
</Button>
</DialogFooter>

View File

@@ -334,5 +334,40 @@
"confirmSwitch": "You have unsaved changes. Are you sure you want to switch projects? Your changes will be lost."
}
}
},
"integrations": {
"github": {
"cliSetup": {
"title": "GitHub CLI Setup",
"description": "GitHub CLI authentication is required to create pull requests and interact with GitHub repositories.",
"setupWillTitle": "This setup will:",
"steps": {
"checkInstalled": "Check if GitHub CLI (gh) is installed",
"installHomebrew": "Install it via Homebrew if needed (macOS)",
"authenticate": "Authenticate with GitHub using OAuth"
},
"setupNote": "The setup will run in the chat window. You'll need to complete the authentication in your browser.",
"runSetup": "Run Setup",
"running": "Running...",
"errors": {
"brewMissing": "Homebrew is not installed. Install it to enable automatic setup.",
"notSupported": "Automatic setup is not supported on this platform. Install GitHub CLI manually.",
"setupFailed": "Failed to run GitHub CLI setup."
},
"help": {
"homebrew": {
"description": "Automatic installation requires Homebrew. Install Homebrew from",
"brewSh": "brew.sh",
"manualInstall": "and then rerun the setup. Alternatively, install GitHub CLI manually with:",
"afterInstall": "After installation, authenticate with:"
},
"manual": {
"description": "Install GitHub CLI from the",
"officialDocs": "official documentation",
"andAuthenticate": "and then authenticate with your GitHub account."
}
}
}
}
}
}

View File

@@ -327,6 +327,22 @@
"closeButton": "Close"
},
"createPrDialog": {
"title": "Create GitHub Pull Request",
"description": "Create a pull request for this task attempt on GitHub.",
"titleLabel": "Title",
"titlePlaceholder": "Enter PR title",
"descriptionLabel": "Description (optional)",
"descriptionPlaceholder": "Enter PR description",
"baseBranchLabel": "Base Branch",
"loadingBranches": "Loading branches...",
"selectBaseBranch": "Select base branch",
"creating": "Creating...",
"createButton": "Create PR",
"errors": {
"insufficientPermissions": "Insufficient permissions. Please ensure the GitHub CLI has the necessary permissions.",
"repoNotFoundOrNoAccess": "Repository not found or no access. Please check your repository access and ensure you are authenticated.",
"failedToCreate": "Failed to create GitHub PR"
},
"loginRequired": {
"title": "Sign in to create a pull request",
"description": "You need to sign in before you can open a pull request for this task. We'll take you to the sign-in page.",

View File

@@ -334,5 +334,40 @@
"confirmSwitch": "Tienes cambios sin guardar. ¿Estás seguro de que quieres cambiar de proyecto? Tus cambios se perderán."
}
}
},
"integrations": {
"github": {
"cliSetup": {
"title": "Configuración de GitHub CLI",
"description": "Se requiere autenticación de GitHub CLI para crear pull requests e interactuar con repositorios de GitHub.",
"setupWillTitle": "Esta configuración:",
"steps": {
"checkInstalled": "Verificar si GitHub CLI (gh) está instalado",
"installHomebrew": "Instalarlo a través de Homebrew si es necesario (macOS)",
"authenticate": "Autenticar con GitHub usando OAuth"
},
"setupNote": "La configuración se ejecutará en la ventana de chat. Necesitarás completar la autenticación en tu navegador.",
"runSetup": "Ejecutar Configuración",
"running": "Ejecutando...",
"errors": {
"brewMissing": "Homebrew no está instalado. Instálalo para habilitar la configuración automática.",
"notSupported": "La configuración automática no está soportada en esta plataforma. Instala GitHub CLI manualmente.",
"setupFailed": "Error al ejecutar la configuración de GitHub CLI."
},
"help": {
"homebrew": {
"description": "La instalación automática requiere Homebrew. Instala Homebrew desde",
"brewSh": "brew.sh",
"manualInstall": "y luego vuelve a ejecutar la configuración. Alternativamente, instala GitHub CLI manualmente con:",
"afterInstall": "Después de la instalación, autentica con:"
},
"manual": {
"description": "Instala GitHub CLI desde la",
"officialDocs": "documentación oficial",
"andAuthenticate": "y luego autentica con tu cuenta de GitHub."
}
}
}
}
}
}

View File

@@ -103,6 +103,22 @@
"closeButton": "Cerrar"
},
"createPrDialog": {
"title": "Crear Pull Request de GitHub",
"description": "Crea un pull request para este intento de tarea en GitHub.",
"titleLabel": "Título",
"titlePlaceholder": "Ingresar título del PR",
"descriptionLabel": "Descripción (opcional)",
"descriptionPlaceholder": "Ingresar descripción del PR",
"baseBranchLabel": "Rama Base",
"loadingBranches": "Cargando ramas...",
"selectBaseBranch": "Seleccionar rama base",
"creating": "Creando...",
"createButton": "Crear PR",
"errors": {
"insufficientPermissions": "Permisos insuficientes. Por favor asegúrate de que la CLI de GitHub tenga los permisos necesarios.",
"repoNotFoundOrNoAccess": "Repositorio no encontrado o sin acceso. Por favor verifica el acceso al repositorio y asegúrate de estar autenticado.",
"failedToCreate": "Error al crear PR de GitHub"
},
"loginRequired": {
"title": "Inicia sesión para crear un pull request",
"description": "Debes iniciar sesión antes de poder abrir un pull request para esta tarea. Te llevaremos a la página de inicio de sesión.",

View File

@@ -334,5 +334,40 @@
"confirmSwitch": "未保存の変更があります。本当にプロジェクトを切り替えますか?変更は失われます。"
}
}
},
"integrations": {
"github": {
"cliSetup": {
"title": "GitHub CLI セットアップ",
"description": "プルリクエストの作成とGitHubリポジトリとのやり取りには、GitHub CLI認証が必要です。",
"setupWillTitle": "このセットアップは次のことを行います:",
"steps": {
"checkInstalled": "GitHub CLI (gh) がインストールされているか確認",
"installHomebrew": "必要に応じてHomebrewでインストールmacOS",
"authenticate": "OAuthを使用してGitHubで認証"
},
"setupNote": "セットアップはチャットウィンドウで実行されます。ブラウザで認証を完了する必要があります。",
"runSetup": "セットアップを実行",
"running": "実行中...",
"errors": {
"brewMissing": "Homebrewがインストールされていません。自動セットアップを有効にするにはインストールしてください。",
"notSupported": "このプラットフォームでは自動セットアップがサポートされていません。GitHub CLIを手動でインストールしてください。",
"setupFailed": "GitHub CLIセットアップの実行に失敗しました。"
},
"help": {
"homebrew": {
"description": "自動インストールにはHomebrewが必要です。次からHomebrewをインストールしてください",
"brewSh": "brew.sh",
"manualInstall": "その後、セットアップを再実行してください。または、次のコマンドでGitHub CLIを手動でインストールしてください",
"afterInstall": "インストール後、次のコマンドで認証してください:"
},
"manual": {
"description": "次からGitHub CLIをインストールしてください",
"officialDocs": "公式ドキュメント",
"andAuthenticate": "その後、GitHubアカウントで認証してください。"
}
}
}
}
}
}

View File

@@ -103,6 +103,22 @@
"closeButton": "閉じる"
},
"createPrDialog": {
"title": "GitHub プルリクエストを作成",
"description": "このタスク試行のプルリクエストをGitHubで作成します。",
"titleLabel": "タイトル",
"titlePlaceholder": "PRタイトルを入力",
"descriptionLabel": "説明 (オプション)",
"descriptionPlaceholder": "PR説明を入力",
"baseBranchLabel": "ベースブランチ",
"loadingBranches": "ブランチを読み込み中...",
"selectBaseBranch": "ベースブランチを選択",
"creating": "作成中...",
"createButton": "PRを作成",
"errors": {
"insufficientPermissions": "権限が不足しています。GitHub CLIに必要な権限があることを確認してください。",
"repoNotFoundOrNoAccess": "リポジトリが見つからないか、アクセス権がありません。リポジトリへのアクセス権を確認し、認証されていることを確認してください。",
"failedToCreate": "GitHub PRの作成に失敗しました"
},
"loginRequired": {
"title": "プルリクエストを作成するにはサインインしてください",
"description": "このタスクでプルリクエストを開く前にサインインが必要です。サインインページに移動します。",

View File

@@ -334,5 +334,40 @@
"confirmSwitch": "저장되지 않은 변경사항이 있습니다. 정말 프로젝트를 전환하시겠습니까? 변경사항이 손실됩니다."
}
}
},
"integrations": {
"github": {
"cliSetup": {
"title": "GitHub CLI 설정",
"description": "풀 리퀘스트를 생성하고 GitHub 리포지토리와 상호작용하려면 GitHub CLI 인증이 필요합니다.",
"setupWillTitle": "이 설정은 다음을 수행합니다:",
"steps": {
"checkInstalled": "GitHub CLI (gh)가 설치되어 있는지 확인",
"installHomebrew": "필요한 경우 Homebrew를 통해 설치 (macOS)",
"authenticate": "OAuth를 사용하여 GitHub로 인증"
},
"setupNote": "설정은 채팅 창에서 실행됩니다. 브라우저에서 인증을 완료해야 합니다.",
"runSetup": "설정 실행",
"running": "실행 중...",
"errors": {
"brewMissing": "Homebrew가 설치되어 있지 않습니다. 자동 설정을 활성화하려면 설치하세요.",
"notSupported": "이 플랫폼에서는 자동 설정이 지원되지 않습니다. GitHub CLI를 수동으로 설치하세요.",
"setupFailed": "GitHub CLI 설정 실행에 실패했습니다."
},
"help": {
"homebrew": {
"description": "자동 설치에는 Homebrew가 필요합니다. 다음에서 Homebrew를 설치하세요",
"brewSh": "brew.sh",
"manualInstall": "그런 다음 설정을 다시 실행하세요. 또는 다음 명령으로 GitHub CLI를 수동으로 설치하세요:",
"afterInstall": "설치 후 다음 명령으로 인증하세요:"
},
"manual": {
"description": "다음에서 GitHub CLI를 설치하세요",
"officialDocs": "공식 문서",
"andAuthenticate": "그런 다음 GitHub 계정으로 인증하세요."
}
}
}
}
}
}

View File

@@ -103,6 +103,22 @@
"closeButton": "닫기"
},
"createPrDialog": {
"title": "GitHub Pull Request 생성",
"description": "이 작업 시도에 대한 Pull Request를 GitHub에서 생성합니다.",
"titleLabel": "제목",
"titlePlaceholder": "PR 제목 입력",
"descriptionLabel": "설명 (선택사항)",
"descriptionPlaceholder": "PR 설명 입력",
"baseBranchLabel": "기본 브랜치",
"loadingBranches": "브랜치 로딩 중...",
"selectBaseBranch": "기본 브랜치 선택",
"creating": "생성 중...",
"createButton": "PR 생성",
"errors": {
"insufficientPermissions": "권한이 부족합니다. GitHub CLI에 필요한 권한이 있는지 확인하세요.",
"repoNotFoundOrNoAccess": "저장소를 찾을 수 없거나 액세스 권한이 없습니다. 저장소 액세스를 확인하고 인증되었는지 확인하세요.",
"failedToCreate": "GitHub PR 생성에 실패했습니다"
},
"loginRequired": {
"title": "Pull Request를 만들려면 로그인하세요",
"description": "이 작업에 대해 풀 리퀘스트를 열기 전에 로그인해야 합니다. 로그인 페이지로 이동합니다.",