Skip to content

🐛 [firestore-translate-text] Broken formatting when using Gemini #2573

@JanKubicek

Description

@JanKubicek

Configuration

  • Extension name: firestore-translate-text
  • Extension version: 0.1.25
  • Configuration values:
    • Translation Provider: Gemini

Describe the problem

When using the extension to translate text, the original formatting is not preserved. Specifically, line breaks (newlines) are removed or collapsed into a single paragraph after translation.

common.ts:120 contains this code:

const sanitizedText = text
.replace(/\/g, "\\")
.replace(/"/g, '\"')
.replace(/\n/g, " ");

which probably causes this issue.

Steps to reproduce:

  1. Select or input text containing multiple lines / paragraphs
  2. Use the extension to translate the text
  3. Observe the translated output
Expected result

The translated text should preserve the original formatting.

Actual result

All line breaks are removed, and the translated text is returned as a single block of text.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in-progressA fix or resolution is in progresstype: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions