firebase / firebase/extensions
🐛 [firestore-translate-text] Broken formatting when using Gemini
- Dominant language
- TypeScript
- Stars
- 979
- Forks
- 433
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 125
Description
### 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.
Contributor guide
Assessment
This issue has not been assessed yet.