Skip to content

fix(ai): correct AI Translate Strings implementation for Crowdin and Enterprise#636

Merged
andrii-bodnar merged 3 commits intomasterfrom
copilot/fix-ai-translate-strings-parameters
Mar 17, 2026
Merged

fix(ai): correct AI Translate Strings implementation for Crowdin and Enterprise#636
andrii-bodnar merged 3 commits intomasterfrom
copilot/fix-ai-translate-strings-parameters

Conversation

Copy link
Contributor

Copilot AI commented Mar 17, 2026

PR #625 implemented the AI Translate Strings endpoint with the wrong URL, request schema, response shape, and was missing the Crowdin Enterprise variant entirely.

Corrections to existing translateAiUserStrings

  • URL: /users/{userId}/ai/translate/strings/users/{userId}/ai/translate
  • Return type: Dropped Status<> async job wrapper — response is synchronous
  • AiTranslateStringsRequest: Replaced { projectId, languageId, stringIds? } with the correct schema:
    • Required: strings: string[], targetLanguageId: string
    • Optional: sourceLanguageId, tmIds, glossaryIds, aiPromptId, aiProviderId, aiModelId, instructions, attachmentIds
  • AiTranslateStringsAttribute → renamed to AiTranslateStringsResponse with fields: sourceLanguageId, targetLanguageId, translations: string[]

New: Crowdin Enterprise support

Added translateAiOrganizationStrings(request) using POST /ai/translate (no userId in path). Reuses the same request/response types — the schemas are identical.

// Crowdin
const result = await crowdin.ai.translateAiUserStrings(userId, {
    strings: ['Hello world'],
    targetLanguageId: 'uk',
    sourceLanguageId: 'en',
});
console.log(result.data.translations); // ['Привіт світ']

// Crowdin Enterprise
const result = await crowdin.ai.translateAiOrganizationStrings({
    strings: ['Hello world'],
    targetLanguageId: 'uk',
});
console.log(result.data.translations); // ['Привіт світ']

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…se types

Co-authored-by: andrii-bodnar <29282228+andrii-bodnar@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix AI Translate Strings method request and response parameters fix(ai): correct AI Translate Strings endpoint URL, request, and response types Mar 17, 2026
Copilot AI requested a review from andrii-bodnar March 17, 2026 08:44
@andrii-bodnar andrii-bodnar marked this pull request as ready for review March 17, 2026 08:49
@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.85%. Comparing base (f6326c0) to head (9a356f7).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #636      +/-   ##
==========================================
+ Coverage   89.83%   89.85%   +0.02%     
==========================================
  Files          41       41              
  Lines        2123     2126       +3     
  Branches      254      254              
==========================================
+ Hits         1907     1910       +3     
  Misses         82       82              
  Partials      134      134              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Co-authored-by: andrii-bodnar <29282228+andrii-bodnar@users.noreply.github.com>
Copilot AI changed the title fix(ai): correct AI Translate Strings endpoint URL, request, and response types fix(ai): correct AI Translate Strings implementation for Crowdin and Enterprise Mar 17, 2026
@andrii-bodnar andrii-bodnar merged commit 35fee0a into master Mar 17, 2026
12 checks passed
@andrii-bodnar andrii-bodnar deleted the copilot/fix-ai-translate-strings-parameters branch March 17, 2026 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants