diff --git a/src/renderer/src/components/right-sidebar/source-control-count-localized-copy.ts b/src/renderer/src/components/right-sidebar/source-control-count-localized-copy.ts new file mode 100644 index 00000000000..a4b6dae2d2f --- /dev/null +++ b/src/renderer/src/components/right-sidebar/source-control-count-localized-copy.ts @@ -0,0 +1,138 @@ +import { translate } from '@/i18n/i18n' + +export function localizedPushCount(ahead: number): string { + return ahead === 1 + ? translate( + 'auto.components.right.sidebar.source.control.dropdown.items.pushCount_one', + 'Push {{count}} commit', + { count: ahead } + ) + : translate( + 'auto.components.right.sidebar.source.control.dropdown.items.pushCount_other', + 'Push {{count}} commits', + { count: ahead } + ) +} + +export function localizedPullCount(behind: number): string { + return behind === 1 + ? translate( + 'auto.components.right.sidebar.source.control.dropdown.items.pullCount_one', + 'Pull {{count}} commit', + { count: behind } + ) + : translate( + 'auto.components.right.sidebar.source.control.dropdown.items.pullCount_other', + 'Pull {{count}} commits', + { count: behind } + ) +} + +export function localizedFastForwardCount(behind: number): string { + return behind === 1 + ? translate( + 'auto.components.right.sidebar.source.control.dropdown.items.fastForwardCount_one', + 'Fast-forward {{count}} commit', + { count: behind } + ) + : translate( + 'auto.components.right.sidebar.source.control.dropdown.items.fastForwardCount_other', + 'Fast-forward {{count}} commits', + { count: behind } + ) +} + +export function localizedSyncCounts(ahead: number, behind: number): string { + return translate( + 'auto.components.right.sidebar.source.control.dropdown.items.syncCounts', + 'Pull {{behind}}, push {{ahead}}', + { ahead, behind } + ) +} + +function localizedUpstreamName(upstreamName: string | undefined): string { + return ( + upstreamName ?? + translate( + 'auto.components.right.sidebar.source.control.dropdown.items.remoteBranchFallback', + 'the remote branch' + ) + ) +} + +export function localizedForcePushWithLease( + branchCommitsAhead: number | undefined, + upstreamName?: string +): string { + const target = localizedUpstreamName(upstreamName) + if (!branchCommitsAhead || branchCommitsAhead <= 0) { + return translate( + 'auto.components.right.sidebar.source.control.dropdown.items.titleForcePushOlderCopiesBranch', + 'Remote only has older copies of local commits. Force push this branch with lease to update {{upstreamName}}.', + { upstreamName: target } + ) + } + return branchCommitsAhead === 1 + ? translate( + 'auto.components.right.sidebar.source.control.dropdown.items.titleForcePushOlderCopiesCount_one', + 'Remote only has older copies of local commits. Force push {{count}} branch commit with lease to update {{upstreamName}}.', + { count: branchCommitsAhead, upstreamName: target } + ) + : translate( + 'auto.components.right.sidebar.source.control.dropdown.items.titleForcePushOlderCopiesCount_other', + 'Remote only has older copies of local commits. Force push {{count}} branch commits with lease to update {{upstreamName}}.', + { count: branchCommitsAhead, upstreamName: target } + ) +} + +export function localizedManualForcePush( + ahead: number, + behind: number, + upstreamName?: string +): string { + const target = localizedUpstreamName(upstreamName) + if (behind > 0) { + return ahead === 1 + ? translate( + 'auto.components.right.sidebar.source.control.dropdown.items.titleManualForcePushReplaceRemote_one', + 'Force push {{count}} local commit with lease to update {{upstreamName}} and replace remote-only commits.', + { count: ahead, upstreamName: target } + ) + : translate( + 'auto.components.right.sidebar.source.control.dropdown.items.titleManualForcePushReplaceRemote_other', + 'Force push {{count}} local commits with lease to update {{upstreamName}} and replace remote-only commits.', + { count: ahead, upstreamName: target } + ) + } + return ahead === 1 + ? translate( + 'auto.components.right.sidebar.source.control.dropdown.items.titleManualForcePush_one', + 'Force push {{count}} local commit with lease to update {{upstreamName}}.', + { count: ahead, upstreamName: target } + ) + : translate( + 'auto.components.right.sidebar.source.control.dropdown.items.titleManualForcePush_other', + 'Force push {{count}} local commits with lease to update {{upstreamName}}.', + { count: ahead, upstreamName: target } + ) +} + +export function localizedUnpublishedForcePush(branchCommitsAhead: number | undefined): string { + if (!branchCommitsAhead || branchCommitsAhead <= 0) { + return translate( + 'auto.components.right.sidebar.source.control.dropdown.items.titleUnpublishedForcePushBranch', + 'Force push this branch with lease and set an upstream if needed.' + ) + } + return branchCommitsAhead === 1 + ? translate( + 'auto.components.right.sidebar.source.control.dropdown.items.titleUnpublishedForcePushCount_one', + 'Force push {{count}} branch commit with lease and set an upstream if needed.', + { count: branchCommitsAhead } + ) + : translate( + 'auto.components.right.sidebar.source.control.dropdown.items.titleUnpublishedForcePushCount_other', + 'Force push {{count}} branch commits with lease and set an upstream if needed.', + { count: branchCommitsAhead } + ) +} diff --git a/src/renderer/src/components/right-sidebar/source-control-dropdown-remote-localized-copy.ts b/src/renderer/src/components/right-sidebar/source-control-dropdown-remote-localized-copy.ts index 2d00ba9985b..eb1c8c7bfc2 100644 --- a/src/renderer/src/components/right-sidebar/source-control-dropdown-remote-localized-copy.ts +++ b/src/renderer/src/components/right-sidebar/source-control-dropdown-remote-localized-copy.ts @@ -1,5 +1,14 @@ import { translate } from '@/i18n/i18n' import type { RemoteDropdownCopy } from '../../../../shared/source-control-dropdown-remote-copy' +import { + localizedFastForwardCount, + localizedForcePushWithLease, + localizedManualForcePush, + localizedPullCount, + localizedPushCount, + localizedSyncCounts, + localizedUnpublishedForcePush +} from './source-control-count-localized-copy' export function localizedRemoteCopy(): RemoteDropdownCopy { return { @@ -198,6 +207,13 @@ export function localizedRemoteCopy(): RemoteDropdownCopy { publishToOrigin: translate( 'auto.components.right.sidebar.source.control.primary.action.1884cf34af', 'Publish this branch to origin' - ) + ), + pushCount: localizedPushCount, + pullCount: localizedPullCount, + fastForwardCount: localizedFastForwardCount, + syncCounts: localizedSyncCounts, + forcePushWithLease: localizedForcePushWithLease, + manualForcePush: localizedManualForcePush, + unpublishedForcePush: localizedUnpublishedForcePush } } diff --git a/src/renderer/src/components/right-sidebar/source-control-primary-action-titles.ts b/src/renderer/src/components/right-sidebar/source-control-primary-action-titles.ts deleted file mode 100644 index cacabd6ad4d..00000000000 --- a/src/renderer/src/components/right-sidebar/source-control-primary-action-titles.ts +++ /dev/null @@ -1,20 +0,0 @@ -export function describePushCount(ahead: number): string { - return `Push ${ahead} commit${ahead === 1 ? '' : 's'}` -} - -export function describePullCount(behind: number): string { - return `Pull ${behind} commit${behind === 1 ? '' : 's'}` -} - -export function describeSyncCounts(ahead: number, behind: number): string { - return `Pull ${behind}, push ${ahead}` -} - -export function describeForcePushWithLease( - count: number | undefined, - upstreamName?: string -): string { - const countText = - count && count > 0 ? `${count} branch commit${count === 1 ? '' : 's'}` : 'this branch' - return `Remote only has older copies of local commits. Force push ${countText} with lease to update ${upstreamName ?? 'the remote branch'}.` -} diff --git a/src/renderer/src/components/right-sidebar/source-control-primary-action.ts b/src/renderer/src/components/right-sidebar/source-control-primary-action.ts index ed3fa462c75..984bc02b50c 100644 --- a/src/renderer/src/components/right-sidebar/source-control-primary-action.ts +++ b/src/renderer/src/components/right-sidebar/source-control-primary-action.ts @@ -10,11 +10,11 @@ import { } from '@/i18n/hosted-review-localized-copy' import type { PrimaryAction, PrimaryActionInputs } from './source-control-primary-action-types' import { - describeForcePushWithLease, - describePullCount, - describePushCount, - describeSyncCounts -} from './source-control-primary-action-titles' + localizedForcePushWithLease, + localizedPullCount, + localizedPushCount, + localizedSyncCounts +} from './source-control-count-localized-copy' export type { PrimaryActionKind, @@ -207,13 +207,13 @@ function resolvePrimaryActionTitle( 'Linked review branch target is unavailable.' ) case 'force_push_with_lease': - return describeForcePushWithLease(decision.count, decision.upstreamName) + return localizedForcePushWithLease(decision.count, decision.upstreamName) case 'sync_counts': - return describeSyncCounts(decision.ahead ?? 0, decision.behind ?? 0) + return localizedSyncCounts(decision.ahead ?? 0, decision.behind ?? 0) case 'pull_count': - return describePullCount(decision.count ?? 0) + return localizedPullCount(decision.count ?? 0) case 'push_count': - return describePushCount(decision.count ?? 0) + return localizedPushCount(decision.count ?? 0) case 'create_review': return translate( 'auto.components.right.sidebar.source.control.primary.action.946a8a05ea', diff --git a/src/renderer/src/i18n/en-runtime-required.json b/src/renderer/src/i18n/en-runtime-required.json index 6fc75fbdab6..8fc670917f3 100644 --- a/src/renderer/src/i18n/en-runtime-required.json +++ b/src/renderer/src/i18n/en-runtime-required.json @@ -1085,6 +1085,24 @@ "6de99d162b": "entry" } }, + "dropdown": { + "items": { + "fastForwardCount_one": "Fast-forward {{count}} commit", + "fastForwardCount_other": "Fast-forward {{count}} commits", + "pullCount_one": "Pull {{count}} commit", + "pullCount_other": "Pull {{count}} commits", + "pushCount_one": "Push {{count}} commit", + "pushCount_other": "Push {{count}} commits", + "titleForcePushOlderCopiesCount_one": "Remote only has older copies of local commits. Force push {{count}} branch commit with lease to update {{upstreamName}}.", + "titleForcePushOlderCopiesCount_other": "Remote only has older copies of local commits. Force push {{count}} branch commits with lease to update {{upstreamName}}.", + "titleManualForcePushReplaceRemote_one": "Force push {{count}} local commit with lease to update {{upstreamName}} and replace remote-only commits.", + "titleManualForcePushReplaceRemote_other": "Force push {{count}} local commits with lease to update {{upstreamName}} and replace remote-only commits.", + "titleManualForcePush_one": "Force push {{count}} local commit with lease to update {{upstreamName}}.", + "titleManualForcePush_other": "Force push {{count}} local commits with lease to update {{upstreamName}}.", + "titleUnpublishedForcePushCount_one": "Force push {{count}} branch commit with lease and set an upstream if needed.", + "titleUnpublishedForcePushCount_other": "Force push {{count}} branch commits with lease and set an upstream if needed." + } + }, "primary": { "action": { "2d8f185fbc": "Stage all changes before committing partially staged files", diff --git a/src/renderer/src/i18n/locales/en.json b/src/renderer/src/i18n/locales/en.json index f088d20ac28..36079dd88c7 100644 --- a/src/renderer/src/i18n/locales/en.json +++ b/src/renderer/src/i18n/locales/en.json @@ -14786,7 +14786,25 @@ "forcePushBeforeReview": "Force Push before {{shortLabel}}", "pushBeforeReview": "Push before {{shortLabel}}", "titleForcePushBeforeCreatingReview": "Force push with lease before creating a {{reviewLabel}}", - "titlePushBeforeCreatingReview": "Push local commits before creating a {{reviewLabel}}" + "titlePushBeforeCreatingReview": "Push local commits before creating a {{reviewLabel}}", + "pushCount_one": "Push {{count}} commit", + "pushCount_other": "Push {{count}} commits", + "pullCount_one": "Pull {{count}} commit", + "pullCount_other": "Pull {{count}} commits", + "fastForwardCount_one": "Fast-forward {{count}} commit", + "fastForwardCount_other": "Fast-forward {{count}} commits", + "syncCounts": "Pull {{behind}}, push {{ahead}}", + "remoteBranchFallback": "the remote branch", + "titleForcePushOlderCopiesBranch": "Remote only has older copies of local commits. Force push this branch with lease to update {{upstreamName}}.", + "titleForcePushOlderCopiesCount_one": "Remote only has older copies of local commits. Force push {{count}} branch commit with lease to update {{upstreamName}}.", + "titleForcePushOlderCopiesCount_other": "Remote only has older copies of local commits. Force push {{count}} branch commits with lease to update {{upstreamName}}.", + "titleManualForcePushReplaceRemote_one": "Force push {{count}} local commit with lease to update {{upstreamName}} and replace remote-only commits.", + "titleManualForcePushReplaceRemote_other": "Force push {{count}} local commits with lease to update {{upstreamName}} and replace remote-only commits.", + "titleManualForcePush_one": "Force push {{count}} local commit with lease to update {{upstreamName}}.", + "titleManualForcePush_other": "Force push {{count}} local commits with lease to update {{upstreamName}}.", + "titleUnpublishedForcePushBranch": "Force push this branch with lease and set an upstream if needed.", + "titleUnpublishedForcePushCount_one": "Force push {{count}} branch commit with lease and set an upstream if needed.", + "titleUnpublishedForcePushCount_other": "Force push {{count}} branch commits with lease and set an upstream if needed." } }, "primary": { diff --git a/src/renderer/src/i18n/locales/es.json b/src/renderer/src/i18n/locales/es.json index af71ad8b7db..c03915f26dc 100644 --- a/src/renderer/src/i18n/locales/es.json +++ b/src/renderer/src/i18n/locales/es.json @@ -14247,7 +14247,25 @@ "forcePushBeforeReview": "Force Push antes de {{shortLabel}}", "pushBeforeReview": "Push antes de {{shortLabel}}", "titleForcePushBeforeCreatingReview": "Haz force push con lease antes de crear un {{reviewLabel}}", - "titlePushBeforeCreatingReview": "Haz push de los commits locales antes de crear un {{reviewLabel}}" + "titlePushBeforeCreatingReview": "Haz push de los commits locales antes de crear un {{reviewLabel}}", + "pushCount_one": "Hacer push de {{count}} commit", + "pushCount_other": "Hacer push de {{count}} commits", + "pullCount_one": "Hacer pull de {{count}} commit", + "pullCount_other": "Hacer pull de {{count}} commits", + "fastForwardCount_one": "Hacer fast-forward de {{count}} commit", + "fastForwardCount_other": "Hacer fast-forward de {{count}} commits", + "syncCounts": "Pull de {{behind}}, push de {{ahead}}", + "remoteBranchFallback": "la rama remota", + "titleForcePushOlderCopiesBranch": "El remoto solo tiene copias antiguas de commits locales. Haz force push con lease de esta rama para actualizar {{upstreamName}}.", + "titleForcePushOlderCopiesCount_one": "El remoto solo tiene copias antiguas de commits locales. Haz force push con lease de {{count}} commit de la rama para actualizar {{upstreamName}}.", + "titleForcePushOlderCopiesCount_other": "El remoto solo tiene copias antiguas de commits locales. Haz force push con lease de {{count}} commits de la rama para actualizar {{upstreamName}}.", + "titleManualForcePush_one": "Haz force push con lease de {{count}} commit local para actualizar {{upstreamName}}.", + "titleManualForcePush_other": "Haz force push con lease de {{count}} commits locales para actualizar {{upstreamName}}.", + "titleManualForcePushReplaceRemote_one": "Haz force push con lease de {{count}} commit local para actualizar {{upstreamName}} y reemplazar los commits que solo están en el remoto.", + "titleManualForcePushReplaceRemote_other": "Haz force push con lease de {{count}} commits locales para actualizar {{upstreamName}} y reemplazar los commits que solo están en el remoto.", + "titleUnpublishedForcePushBranch": "Haz force push con lease de esta rama y configura un upstream si es necesario.", + "titleUnpublishedForcePushCount_one": "Haz force push con lease de {{count}} commit de la rama y configura un upstream si es necesario.", + "titleUnpublishedForcePushCount_other": "Haz force push con lease de {{count}} commits de la rama y configura un upstream si es necesario." } }, "primary": { diff --git a/src/renderer/src/i18n/locales/fr.json b/src/renderer/src/i18n/locales/fr.json index 51b0360016a..dc71e49b007 100644 --- a/src/renderer/src/i18n/locales/fr.json +++ b/src/renderer/src/i18n/locales/fr.json @@ -14414,7 +14414,25 @@ "forcePushBeforeReview": "Force Push avant {{shortLabel}}", "pushBeforeReview": "Push avant {{shortLabel}}", "titleForcePushBeforeCreatingReview": "Faites un force push avec lease avant de créer une {{reviewLabel}}", - "titlePushBeforeCreatingReview": "Poussez les commits locaux avant de créer une {{reviewLabel}}" + "titlePushBeforeCreatingReview": "Poussez les commits locaux avant de créer une {{reviewLabel}}", + "pushCount_one": "Pousser {{count}} commit", + "pushCount_other": "Pousser {{count}} commits", + "pullCount_one": "Tirer {{count}} commit", + "pullCount_other": "Tirer {{count}} commits", + "fastForwardCount_one": "Faire un fast-forward de {{count}} commit", + "fastForwardCount_other": "Faire un fast-forward de {{count}} commits", + "syncCounts": "Tirer {{behind}}, pousser {{ahead}}", + "remoteBranchFallback": "la branche distante", + "titleForcePushOlderCopiesBranch": "Le remote n'a que d'anciennes copies des commits locaux. Faites un force push avec lease de cette branche pour mettre à jour {{upstreamName}}.", + "titleForcePushOlderCopiesCount_one": "Le remote n'a que d'anciennes copies des commits locaux. Faites un force push avec lease de {{count}} commit de la branche pour mettre à jour {{upstreamName}}.", + "titleForcePushOlderCopiesCount_other": "Le remote n'a que d'anciennes copies des commits locaux. Faites un force push avec lease de {{count}} commits de la branche pour mettre à jour {{upstreamName}}.", + "titleManualForcePush_one": "Faites un force push avec lease de {{count}} commit local pour mettre à jour {{upstreamName}}.", + "titleManualForcePush_other": "Faites un force push avec lease de {{count}} commits locaux pour mettre à jour {{upstreamName}}.", + "titleManualForcePushReplaceRemote_one": "Faites un force push avec lease de {{count}} commit local pour mettre à jour {{upstreamName}} et remplacer les commits présents uniquement sur le remote.", + "titleManualForcePushReplaceRemote_other": "Faites un force push avec lease de {{count}} commits locaux pour mettre à jour {{upstreamName}} et remplacer les commits présents uniquement sur le remote.", + "titleUnpublishedForcePushBranch": "Faites un force push avec lease de cette branche et définissez un upstream si nécessaire.", + "titleUnpublishedForcePushCount_one": "Faites un force push avec lease de {{count}} commit de la branche et définissez un upstream si nécessaire.", + "titleUnpublishedForcePushCount_other": "Faites un force push avec lease de {{count}} commits de la branche et définissez un upstream si nécessaire." } }, "primary": { diff --git a/src/renderer/src/i18n/locales/ja.json b/src/renderer/src/i18n/locales/ja.json index 805a1d0fccf..dd174eb9047 100644 --- a/src/renderer/src/i18n/locales/ja.json +++ b/src/renderer/src/i18n/locales/ja.json @@ -14276,7 +14276,25 @@ "forcePushBeforeReview": "強制プッシュしてから {{shortLabel}} を作成", "pushBeforeReview": "プッシュしてから {{shortLabel}} を作成", "titleForcePushBeforeCreatingReview": "{{reviewLabel}} を作成する前に lease 付きで強制プッシュ", - "titlePushBeforeCreatingReview": "{{reviewLabel}} を作成する前にローカルのコミットをプッシュ" + "titlePushBeforeCreatingReview": "{{reviewLabel}} を作成する前にローカルのコミットをプッシュ", + "pushCount_one": "{{count}} 件のコミットをプッシュ", + "pushCount_other": "{{count}} 件のコミットをプッシュ", + "pullCount_one": "{{count}} 件のコミットをプル", + "pullCount_other": "{{count}} 件のコミットをプル", + "fastForwardCount_one": "{{count}} 件のコミットを fast-forward", + "fastForwardCount_other": "{{count}} 件のコミットを fast-forward", + "syncCounts": "{{behind}} 件をプル、{{ahead}} 件をプッシュ", + "remoteBranchFallback": "リモートブランチ", + "titleForcePushOlderCopiesBranch": "リモートにはローカルコミットの古いコピーしかありません。このブランチを lease 付きで強制プッシュして {{upstreamName}} を更新します。", + "titleForcePushOlderCopiesCount_one": "リモートにはローカルコミットの古いコピーしかありません。{{count}} 件のブランチコミットを lease 付きで強制プッシュして {{upstreamName}} を更新します。", + "titleForcePushOlderCopiesCount_other": "リモートにはローカルコミットの古いコピーしかありません。{{count}} 件のブランチコミットを lease 付きで強制プッシュして {{upstreamName}} を更新します。", + "titleManualForcePush_one": "{{count}} 件のローカルコミットを lease 付きで強制プッシュして {{upstreamName}} を更新します。", + "titleManualForcePush_other": "{{count}} 件のローカルコミットを lease 付きで強制プッシュして {{upstreamName}} を更新します。", + "titleManualForcePushReplaceRemote_one": "{{count}} 件のローカルコミットを lease 付きで強制プッシュして {{upstreamName}} を更新し、リモートにのみあるコミットを置き換えます。", + "titleManualForcePushReplaceRemote_other": "{{count}} 件のローカルコミットを lease 付きで強制プッシュして {{upstreamName}} を更新し、リモートにのみあるコミットを置き換えます。", + "titleUnpublishedForcePushBranch": "このブランチを lease 付きで強制プッシュし、必要に応じてアップストリームを設定します。", + "titleUnpublishedForcePushCount_one": "{{count}} 件のブランチコミットを lease 付きで強制プッシュし、必要に応じてアップストリームを設定します。", + "titleUnpublishedForcePushCount_other": "{{count}} 件のブランチコミットを lease 付きで強制プッシュし、必要に応じてアップストリームを設定します。" } }, "primary": { diff --git a/src/renderer/src/i18n/locales/ko.json b/src/renderer/src/i18n/locales/ko.json index f9a327597a2..5a861ef85eb 100644 --- a/src/renderer/src/i18n/locales/ko.json +++ b/src/renderer/src/i18n/locales/ko.json @@ -14214,7 +14214,25 @@ "forcePushBeforeReview": "강제 푸시 후 {{shortLabel}} 만들기", "pushBeforeReview": "푸시 후 {{shortLabel}} 만들기", "titleForcePushBeforeCreatingReview": "{{reviewLabel}}을(를) 만들기 전에 lease로 강제 푸시", - "titlePushBeforeCreatingReview": "{{reviewLabel}}을(를) 만들기 전에 로컬 commits 푸시" + "titlePushBeforeCreatingReview": "{{reviewLabel}}을(를) 만들기 전에 로컬 commits 푸시", + "pushCount_one": "커밋 {{count}}개 푸시", + "pushCount_other": "커밋 {{count}}개 푸시", + "pullCount_one": "커밋 {{count}}개 풀", + "pullCount_other": "커밋 {{count}}개 풀", + "fastForwardCount_one": "커밋 {{count}}개 fast-forward", + "fastForwardCount_other": "커밋 {{count}}개 fast-forward", + "syncCounts": "{{behind}}개 풀, {{ahead}}개 푸시", + "remoteBranchFallback": "원격 브랜치", + "titleForcePushOlderCopiesBranch": "원격에는 로컬 커밋의 이전 사본만 있습니다. {{upstreamName}}을(를) 업데이트하려면 이 브랜치를 lease로 강제 푸시하세요.", + "titleForcePushOlderCopiesCount_one": "원격에는 로컬 커밋의 이전 사본만 있습니다. {{upstreamName}}을(를) 업데이트하려면 브랜치 커밋 {{count}}개를 lease로 강제 푸시하세요.", + "titleForcePushOlderCopiesCount_other": "원격에는 로컬 커밋의 이전 사본만 있습니다. {{upstreamName}}을(를) 업데이트하려면 브랜치 커밋 {{count}}개를 lease로 강제 푸시하세요.", + "titleManualForcePush_one": "로컬 커밋 {{count}}개를 lease로 강제 푸시하여 {{upstreamName}}을(를) 업데이트합니다.", + "titleManualForcePush_other": "로컬 커밋 {{count}}개를 lease로 강제 푸시하여 {{upstreamName}}을(를) 업데이트합니다.", + "titleManualForcePushReplaceRemote_one": "로컬 커밋 {{count}}개를 lease로 강제 푸시하여 {{upstreamName}}을(를) 업데이트하고 원격에만 있는 커밋을 대체합니다.", + "titleManualForcePushReplaceRemote_other": "로컬 커밋 {{count}}개를 lease로 강제 푸시하여 {{upstreamName}}을(를) 업데이트하고 원격에만 있는 커밋을 대체합니다.", + "titleUnpublishedForcePushBranch": "이 브랜치를 lease로 강제 푸시하고 필요하면 업스트림을 설정합니다.", + "titleUnpublishedForcePushCount_one": "브랜치 커밋 {{count}}개를 lease로 강제 푸시하고 필요하면 업스트림을 설정합니다.", + "titleUnpublishedForcePushCount_other": "브랜치 커밋 {{count}}개를 lease로 강제 푸시하고 필요하면 업스트림을 설정합니다." } }, "primary": { diff --git a/src/renderer/src/i18n/locales/pt.json b/src/renderer/src/i18n/locales/pt.json index 4d3be7fc624..563ab05e78f 100644 --- a/src/renderer/src/i18n/locales/pt.json +++ b/src/renderer/src/i18n/locales/pt.json @@ -9673,7 +9673,25 @@ "forcePushBeforeReview": "Force Push antes de {{shortLabel}}", "pushBeforeReview": "Push antes de {{shortLabel}}", "titleForcePushBeforeCreatingReview": "Faça force push com lease antes de criar um(a) {{reviewLabel}}", - "titlePushBeforeCreatingReview": "Faça push dos commits locais antes de criar um(a) {{reviewLabel}}" + "titlePushBeforeCreatingReview": "Faça push dos commits locais antes de criar um(a) {{reviewLabel}}", + "pushCount_one": "Fazer push de {{count}} commit", + "pushCount_other": "Fazer push de {{count}} commits", + "pullCount_one": "Fazer pull de {{count}} commit", + "pullCount_other": "Fazer pull de {{count}} commits", + "fastForwardCount_one": "Fazer fast-forward de {{count}} commit", + "fastForwardCount_other": "Fazer fast-forward de {{count}} commits", + "syncCounts": "Pull de {{behind}}, push de {{ahead}}", + "remoteBranchFallback": "a branch remota", + "titleForcePushOlderCopiesBranch": "O remoto só tem cópias antigas de commits locais. Faça force push com lease desta branch para atualizar {{upstreamName}}.", + "titleForcePushOlderCopiesCount_one": "O remoto só tem cópias antigas de commits locais. Faça force push com lease de {{count}} commit da branch para atualizar {{upstreamName}}.", + "titleForcePushOlderCopiesCount_other": "O remoto só tem cópias antigas de commits locais. Faça force push com lease de {{count}} commits da branch para atualizar {{upstreamName}}.", + "titleManualForcePush_one": "Faça force push com lease de {{count}} commit local para atualizar {{upstreamName}}.", + "titleManualForcePush_other": "Faça force push com lease de {{count}} commits locais para atualizar {{upstreamName}}.", + "titleManualForcePushReplaceRemote_one": "Faça force push com lease de {{count}} commit local para atualizar {{upstreamName}} e substituir os commits que só existem no remoto.", + "titleManualForcePushReplaceRemote_other": "Faça force push com lease de {{count}} commits locais para atualizar {{upstreamName}} e substituir os commits que só existem no remoto.", + "titleUnpublishedForcePushBranch": "Faça force push com lease desta branch e defina um upstream se necessário.", + "titleUnpublishedForcePushCount_one": "Faça force push com lease de {{count}} commit da branch e defina um upstream se necessário.", + "titleUnpublishedForcePushCount_other": "Faça force push com lease de {{count}} commits da branch e defina um upstream se necessário." } }, "primary": { diff --git a/src/renderer/src/i18n/locales/zh.json b/src/renderer/src/i18n/locales/zh.json index c2616b786d6..5df22696dc9 100644 --- a/src/renderer/src/i18n/locales/zh.json +++ b/src/renderer/src/i18n/locales/zh.json @@ -14214,7 +14214,25 @@ "forcePushBeforeReview": "先强制推送再创建 {{shortLabel}}", "pushBeforeReview": "先推送再创建 {{shortLabel}}", "titleForcePushBeforeCreatingReview": "在创建 {{reviewLabel}} 之前使用 lease 强制推送", - "titlePushBeforeCreatingReview": "在创建 {{reviewLabel}} 之前推送本地提交" + "titlePushBeforeCreatingReview": "在创建 {{reviewLabel}} 之前推送本地提交", + "pushCount_one": "推送 {{count}} 个提交", + "pushCount_other": "推送 {{count}} 个提交", + "pullCount_one": "拉取 {{count}} 个提交", + "pullCount_other": "拉取 {{count}} 个提交", + "fastForwardCount_one": "快进 {{count}} 个提交", + "fastForwardCount_other": "快进 {{count}} 个提交", + "syncCounts": "拉取 {{behind}} 个,推送 {{ahead}} 个", + "remoteBranchFallback": "远程分支", + "titleForcePushOlderCopiesBranch": "远程只有本地提交的旧副本。使用 lease 强制推送此分支以更新 {{upstreamName}}。", + "titleForcePushOlderCopiesCount_one": "远程只有本地提交的旧副本。使用 lease 强制推送 {{count}} 个分支提交以更新 {{upstreamName}}。", + "titleForcePushOlderCopiesCount_other": "远程只有本地提交的旧副本。使用 lease 强制推送 {{count}} 个分支提交以更新 {{upstreamName}}。", + "titleManualForcePush_one": "使用 lease 强制推送 {{count}} 个本地提交以更新 {{upstreamName}}。", + "titleManualForcePush_other": "使用 lease 强制推送 {{count}} 个本地提交以更新 {{upstreamName}}。", + "titleManualForcePushReplaceRemote_one": "使用 lease 强制推送 {{count}} 个本地提交以更新 {{upstreamName}},并替换仅存在于远程的提交。", + "titleManualForcePushReplaceRemote_other": "使用 lease 强制推送 {{count}} 个本地提交以更新 {{upstreamName}},并替换仅存在于远程的提交。", + "titleUnpublishedForcePushBranch": "使用 lease 强制推送此分支,并在需要时设置上游。", + "titleUnpublishedForcePushCount_one": "使用 lease 强制推送 {{count}} 个分支提交,并在需要时设置上游。", + "titleUnpublishedForcePushCount_other": "使用 lease 强制推送 {{count}} 个分支提交,并在需要时设置上游。" } }, "primary": { diff --git a/src/shared/source-control-dropdown-action-context.ts b/src/shared/source-control-dropdown-action-context.ts index 25d2c20c5fb..3eb8e153e1d 100644 --- a/src/shared/source-control-dropdown-action-context.ts +++ b/src/shared/source-control-dropdown-action-context.ts @@ -5,7 +5,6 @@ import { canSubmitCommit, resolveCommitDisabledReason } from './source-control-c import type { GitConflictOperation } from './git-status-types' import { shouldForcePushWithLeaseForUpstream } from './git-upstream-status' import type { DropdownActionInputs } from './source-control-dropdown-item-types' -import { formatForcePushTitle } from './source-control-dropdown-labels' export type DropdownActionContext = { upstreamStatus: SourceControlPrimaryActionDecisionInputs['upstreamStatus'] @@ -29,7 +28,6 @@ export type DropdownActionContext = { behind: number shouldForcePushWithLease: boolean pushLabelCount: number - forcePushTitle: string globalBusy: boolean commitDisabledReason: ReturnType canCommit: boolean @@ -84,7 +82,6 @@ export function deriveDropdownActionContext(inputs: DropdownActionInputs): Dropd (shouldForcePushWithLease || !hasUpstream) ? branchCommitsAhead : ahead - const forcePushTitle = formatForcePushTitle(branchCommitsAhead, upstreamStatus?.upstreamName) // Lock all rows during in-flight work to prevent queued actions against stale snapshots. const globalBusy = isCommitting || isRemoteOperationActive || isPullRequestOperationActive @@ -129,7 +126,6 @@ export function deriveDropdownActionContext(inputs: DropdownActionInputs): Dropd behind, shouldForcePushWithLease, pushLabelCount, - forcePushTitle, globalBusy, commitDisabledReason, canCommit diff --git a/src/shared/source-control-dropdown-remote-copy.ts b/src/shared/source-control-dropdown-remote-copy.ts index ad88ef6ffed..e8130c32f27 100644 --- a/src/shared/source-control-dropdown-remote-copy.ts +++ b/src/shared/source-control-dropdown-remote-copy.ts @@ -1,3 +1,13 @@ +import { + describeFastForwardCount, + describePullCount, + describePushCount, + describeSyncCounts, + formatForcePushTitle, + formatManualForcePushTitle, + formatUnpublishedForcePushTitle +} from './source-control-dropdown-labels' + // Desktop localizes these strings; other clients pass their own copy. export type RemoteDropdownCopy = { push: string @@ -47,6 +57,13 @@ export type RemoteDropdownCopy = { checkOutBranchToPublish: string branchAlreadyPublished: string publishToOrigin: string + pushCount: (ahead: number) => string + pullCount: (behind: number) => string + fastForwardCount: (behind: number) => string + syncCounts: (ahead: number, behind: number) => string + forcePushWithLease: (branchCommitsAhead: number | undefined, upstreamName?: string) => string + manualForcePush: (ahead: number, behind: number, upstreamName?: string) => string + unpublishedForcePush: (branchCommitsAhead: number | undefined) => string } export const ENGLISH_REMOTE_DROPDOWN_COPY: RemoteDropdownCopy = { @@ -97,5 +114,12 @@ export const ENGLISH_REMOTE_DROPDOWN_COPY: RemoteDropdownCopy = { linkedReviewBranchExists: 'Linked review branch already exists', checkOutBranchToPublish: 'Check out a branch before publishing commits', branchAlreadyPublished: 'Branch is already published', - publishToOrigin: 'Publish this branch to origin' + publishToOrigin: 'Publish this branch to origin', + pushCount: describePushCount, + pullCount: describePullCount, + fastForwardCount: describeFastForwardCount, + syncCounts: describeSyncCounts, + forcePushWithLease: formatForcePushTitle, + manualForcePush: formatManualForcePushTitle, + unpublishedForcePush: formatUnpublishedForcePushTitle } diff --git a/src/shared/source-control-dropdown-remote-items.ts b/src/shared/source-control-dropdown-remote-items.ts index 737f66a48bf..997b30d3f65 100644 --- a/src/shared/source-control-dropdown-remote-items.ts +++ b/src/shared/source-control-dropdown-remote-items.ts @@ -1,15 +1,9 @@ import type { DropdownItem } from './source-control-dropdown-item-types' import type { DropdownActionContext } from './source-control-dropdown-action-context' import { - describeFastForwardCount, - describePullCount, - describePushCount, - describeSyncCounts, formatCountLabel, - formatManualForcePushTitle, formatRebaseBaseRef, - formatSyncLabel, - formatUnpublishedForcePushTitle + formatSyncLabel } from './source-control-dropdown-labels' import { ENGLISH_REMOTE_DROPDOWN_COPY, @@ -49,8 +43,7 @@ export function buildRemoteDropdownItems( ahead, behind, shouldForcePushWithLease, - pushLabelCount, - forcePushTitle + pushLabelCount } = ctx const push: DropdownItem = { @@ -74,7 +67,7 @@ export function buildRemoteDropdownItems( ? upstreamStatus?.upstreamName ? copy.nothingToPushTo(upstreamStatus.upstreamName) : copy.nothingToPush - : describePushCount(ahead), + : copy.pushCount(ahead), // Push can set upstream and coexist with force-with-lease; detached HEAD and unknown review targets still block it. disabled: globalBusy || publishBlockedByDetachedHead || pushBlockedByOpenHostedReviewTarget } @@ -87,16 +80,16 @@ export function buildRemoteDropdownItems( : pushBlockedByOpenHostedReviewTarget ? copy.linkedReviewTargetUnavailable : upstreamLoading - ? formatUnpublishedForcePushTitle(branchCommitsAhead) + ? copy.unpublishedForcePush(branchCommitsAhead) : !hasUpstream - ? formatUnpublishedForcePushTitle(branchCommitsAhead) + ? copy.unpublishedForcePush(branchCommitsAhead) : pushLabelCount === 0 ? upstreamStatus?.upstreamName ? copy.nothingToForcePushTo(upstreamStatus.upstreamName) : copy.nothingToForcePush : shouldForcePushWithLease - ? forcePushTitle - : formatManualForcePushTitle(pushLabelCount, behind, upstreamStatus?.upstreamName), + ? copy.forcePushWithLease(branchCommitsAhead, upstreamStatus?.upstreamName) + : copy.manualForcePush(pushLabelCount, behind, upstreamStatus?.upstreamName), // Match Push target safety; force-with-lease must not push the wrong review head. disabled: globalBusy || publishBlockedByDetachedHead || pushBlockedByOpenHostedReviewTarget } @@ -118,7 +111,7 @@ export function buildRemoteDropdownItems( ? copy.nothingNewToPull : behind === 0 ? copy.nothingToPull - : describePullCount(behind), + : copy.pullCount(behind), disabled: globalBusy || upstreamLoading || !hasUpstream || publishBlockedByDetachedHead } @@ -141,7 +134,7 @@ export function buildRemoteDropdownItems( ? copy.nothingToFastForward : ahead > 0 ? copy.tryFastForwardPull - : describeFastForwardCount(behind), + : copy.fastForwardCount(behind), disabled: globalBusy || upstreamLoading || !hasUpstream || publishBlockedByDetachedHead } @@ -162,7 +155,7 @@ export function buildRemoteDropdownItems( ? copy.useForcePushToSync : ahead === 0 && behind === 0 ? copy.branchUpToDate - : describeSyncCounts(ahead, behind), + : copy.syncCounts(ahead, behind), disabled: globalBusy || upstreamLoading ||