iachat/app/javascript/dashboard/components-next/message/bubbles
Sivin Varghese 72509f9e38
chore: Improve translation service with HTML and plain text support (#11305)
# Pull Request Template

## Description

This PR changes to translation to properly handle different content
types during translation.

### Changes

1. **Email translation with HTML support**
   - Properly detects and preserves HTML content from emails
   - Sets `mime_type` to 'text/html' when HTML content is present

2. **Email translation with plain text support**
   - Falls back to email text content when HTML is not available
- Sets `mime_type` to 'text/plain' when HTML is not available and
content type includes 'text/plain'

3. **Plain message with plain text support (Non email channels)**
   - Sets `mime_type` to 'text/plain' for non-email channels
- Fixes an issue where Markdown formatting was being lost due to
incorrect `mime_type`
   
**Note**: Translation for very long emails is not currently supported.

Fixes
https://linear.app/chatwoot/issue/CW-4244/translate-button-doesnt-work-in-email-channels

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)

## How Has This Been Tested?

**Loom video**

https://www.loom.com/share/8f8428ed2cfe415ea5cb6c547c070f00?sid=eab9fa11-05f8-4838-9181-334bee1023c4


## Checklist:

- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my code
- [x] I have commented on my code, particularly in hard-to-understand
areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] New and existing unit tests pass locally with my changes
- [ ] Any dependent changes have been merged and published in downstream
modules
2025-04-16 17:59:06 +05:30
..
Email chore: Improve translation service with HTML and plain text support (#11305) 2025-04-16 17:59:06 +05:30
Text chore: Improve translation service with HTML and plain text support (#11305) 2025-04-16 17:59:06 +05:30
Activity.vue revert: Next bubble improvements (#10795) 2025-01-29 20:04:45 -08:00
Audio.vue fix: Fix the issue with context menu for right click on images and videos (#11114) 2025-03-19 20:09:44 -07:00
Base.vue revert: Next bubble improvements (#10795) 2025-01-29 20:04:45 -08:00
BaseAttachment.vue fix: Incorrect translation in contact merge modal and resolve z-index issue (#10943) 2025-02-20 22:01:36 -08:00
Contact.vue feat: Show shared contact's name in Telegram channel (#10856) 2025-02-11 19:39:54 +05:30
CSAT.vue feat: add CSAT & Form bubble (#10711) 2025-01-17 15:30:52 +05:30
Dyte.vue fix: Fix issues with leave room button (#10942) 2025-02-20 20:27:17 -08:00
File.vue feat: integrate new bubbles (#10550) 2024-12-19 18:41:55 +05:30
Form.vue feat: check if item is present (#10715) 2025-01-18 18:31:07 +05:30
Image.vue fix: Fix the issue with context menu for right click on images and videos (#11114) 2025-03-19 20:09:44 -07:00
InstagramStory.vue fix: Fix the issue with context menu for right click on images and videos (#11114) 2025-03-19 20:09:44 -07:00
Location.vue feat: integrate new bubbles (#10550) 2024-12-19 18:41:55 +05:30
Unsupported.vue feat: Add new message bubbles (#10481) 2024-12-12 17:42:22 -08:00
Video.vue fix: Fix the issue with context menu for right click on images and videos (#11114) 2025-03-19 20:09:44 -07:00