Skip to content

feat:Combine Translation and Language Detection in Gemini API Response #52

Description

@hemanthreddy55

Is your feature request related to a problem? Please describe.
Currently, we make a separate API call to detect the source language before translating text. This adds extra overhead and slows down the workflow. It’s frustrating to make multiple calls when the translation API already has the capability to detect the language.

Describe the solution you'd like
Modify Gemini to return a JSON response that includes both the translated text and the detected source language, for example:

{
  "translation": "",
  "source_language": ""
}

This will eliminate the need for a separate language detection API call.

Describe alternatives you've considered
The alternative is to continue using a separate API call solely for language detection, but this is less efficient and increases latency.

Additional context
This change would streamline the translation workflow, reduce API usage, and improve performance.

Note: Please add the Hacktoberfest label to this issue.

Activity

  1. github-actions commented on Oct 14, 2025

    @github-actions

    Hello @hemanth5055! 👋
    Thank you so much for taking the time to open your first issue with CodeTranslateAI. We appreciate you helping us make the project better!
    We'll take a look and get back to you soon.

  2. dineshsutihar commented on Oct 21, 2025

    @dineshsutihar
    Collaborator

    Thanks a lot for following up the issue with this PR!
    The implementation looks solid and aligns well with the proposed design - returning both the translation and detected source language in the same response is a great improvement for performance and usability.

    I’ll take a closer look at the code to verify edge cases before merging.

    Really appreciate your contribution this will make the translation flow much smoother. 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature requesthacktoberfestreviewissue/bug require reviewed by owner

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions