mirror of
https://github.com/stablyai/orca.git
synced 2026-11-02 18:17:36 +00:00
fix(i18n): localize PR merge/close confirmations and merge method labels (#28568)
PR close/reopen/merge confirmation titles were built from a fragment
template ("{{value0}} PR #{{value1}}?"), so locales could not reorder the
verb, and merge method labels came from English-only shared constants.
Add whole-sentence title keys per action and merge method plus translated
merge method labels in a renderer copy module, and route every PR surface
(item dialog, PR page, Tasks MergeCell, right-sidebar HostedReviewActions)
through it. Drop the English labels from the shared merge-method
presentation and remove the dead fragment keys from all locales.
Co-authored-by: Neil <4138956+nwparker@users.noreply.github.com>
This commit is contained in:
@@ -8,12 +8,7 @@ describe('GitHub PR merge methods', () => {
|
||||
it('keeps the historical squash-first fallback when repository metadata is missing', () => {
|
||||
expect(resolveGitHubPRMergeMethods()).toEqual({
|
||||
defaultMethod: 'squash',
|
||||
defaultLabel: 'Squash and merge',
|
||||
methods: [
|
||||
{ method: 'squash', label: 'Squash and merge' },
|
||||
{ method: 'merge', label: 'Create merge commit' },
|
||||
{ method: 'rebase', label: 'Rebase and merge' }
|
||||
]
|
||||
methods: ['squash', 'merge', 'rebase']
|
||||
})
|
||||
})
|
||||
|
||||
@@ -27,11 +22,7 @@ describe('GitHub PR merge methods', () => {
|
||||
|
||||
expect(resolveGitHubPRMergeMethods(settings)).toEqual({
|
||||
defaultMethod: 'rebase',
|
||||
defaultLabel: 'Rebase and merge',
|
||||
methods: [
|
||||
{ method: 'rebase', label: 'Rebase and merge' },
|
||||
{ method: 'squash', label: 'Squash and merge' }
|
||||
]
|
||||
methods: ['rebase', 'squash']
|
||||
})
|
||||
})
|
||||
|
||||
@@ -44,8 +35,6 @@ describe('GitHub PR merge methods', () => {
|
||||
})
|
||||
|
||||
expect(settings?.defaultMethod).toBe('merge')
|
||||
expect(resolveGitHubPRMergeMethods(settings).methods).toEqual([
|
||||
{ method: 'merge', label: 'Create merge commit' }
|
||||
])
|
||||
expect(resolveGitHubPRMergeMethods(settings).methods).toEqual(['merge'])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -2,21 +2,9 @@ import type { GitHubPRMergeMethod, GitHubPRMergeMethodSettings } from './pull-re
|
||||
|
||||
export const GITHUB_PR_MERGE_METHODS = ['squash', 'merge', 'rebase'] as const
|
||||
|
||||
export const GITHUB_PR_MERGE_METHOD_LABELS: Record<GitHubPRMergeMethod, string> = {
|
||||
squash: 'Squash and merge',
|
||||
merge: 'Create merge commit',
|
||||
rebase: 'Rebase and merge'
|
||||
}
|
||||
|
||||
export type GitHubPRMergeMethodOption = {
|
||||
method: GitHubPRMergeMethod
|
||||
label: string
|
||||
}
|
||||
|
||||
export type GitHubPRMergeMethodPresentation = {
|
||||
defaultMethod: GitHubPRMergeMethod
|
||||
defaultLabel: string
|
||||
methods: GitHubPRMergeMethodOption[]
|
||||
methods: GitHubPRMergeMethod[]
|
||||
}
|
||||
|
||||
function allMethodsAllowed(): Record<GitHubPRMergeMethod, boolean> {
|
||||
@@ -79,15 +67,8 @@ export function resolveGitHubPRMergeMethods(
|
||||
defaultMethod,
|
||||
...GITHUB_PR_MERGE_METHODS.filter((method) => method !== defaultMethod)
|
||||
].filter((method) => allowedMethods[method])
|
||||
const methods = (orderedMethods.length > 0 ? orderedMethods : GITHUB_PR_MERGE_METHODS).map(
|
||||
(method) => ({
|
||||
method,
|
||||
label: GITHUB_PR_MERGE_METHOD_LABELS[method]
|
||||
})
|
||||
)
|
||||
return {
|
||||
defaultMethod,
|
||||
defaultLabel: GITHUB_PR_MERGE_METHOD_LABELS[defaultMethod],
|
||||
methods
|
||||
methods: orderedMethods.length > 0 ? orderedMethods : [...GITHUB_PR_MERGE_METHODS]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user