Aws::Translate::Client - translate_text Returns Random Do-Not-Translate IDs or Skips Translations Depending on < and > Character Usage
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 25/100
Hướng nghiên cứu
Không xác định được tệp repository hoặc bài kiểm thử nào. Chạy lại hai bản tái hiện Ruby với aws-sdk-translate 1.79.0 và so sánh request của client với response của AWS Translate để xác định lỗi nằm ở service hay client; hoàn tất nghĩa là đã xác nhận bên chịu trách nhiệm và hành vi của DNT IDs cùng phần văn bản bị bỏ qua đã được giải quyết hoặc ghi nhận trong tài liệu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
Sorry if this is the wrong place to report this since this is an issue with the API and not the Ruby client, but I noticed this when testing out the do-not-translate syntax and I have examples in Ruby to illustrate the problems. There are 2 issues which are probably related.
A. Internal IDs Are Returned
# Good. Skips translating the text.
Aws::Translate::Client.new.translate_text(text: '<span translate="no">Skip me</span>', source_language_code: 'en', target_language_code: 'fr').translated_text
=> "<span translate=\"no\">Skip me</span>"
# Good. Extra ">" on the right side doesn't cause problems.
Aws::Translate::Client.new.translate_text(text: '<span translate="no">Skip me</span>>', source_language_code: 'en', target_language_code: 'fr').translated_text
=> "<span translate=\"no\">Skip me</span> >"
# Bad. Extra "<" on the left side returns gibberish.
Aws::Translate::Client.new.translate_text(text: '<<span translate="no">Skip me</span>', source_language_code: 'en', target_language_code: 'fr').translated_text
=> "<DNT_GEBKJMMFHEHCKOAJBKHKJHCAkDHDNDDD"
This appears to be returning a unique random ID for some kind of "Do-Not-Translate" element because the response always starts with "DNT_" or "dnt_", followed by 32 random characters.
This isn't a huge issue because the example is contrived and the input isn't valid HTML, but there may be a problem somewhere down in the do-not-translate parsing which reveals internal values.
B. Text Between Greater Than and Less Than Characters Can Remain Untranslated
Probably as a result of how the do-not-translate parsing works, there's also a different issue where text between < and > characters sometimes isn't translated depending on other punctuation involved. I'm not sure how to avoid this because even when using < and > to escape the characters some text may remain untranslated.
# Good. Translates everything when there's a "." between the "<" and ">"
text = "If expenses < revenue then we have a profit. But if expenses > revenue then we have a loss."
Aws::Translate::Client.new.translate_text(text: text, source_language_code: 'en', target_language_code: 'fr').translated_text
=> "Si les dépenses sont inférieures aux recettes, nous avons un bénéfice. Mais si dépenses > recettes, nous avons une perte."
# Bad. Skips Translating text between "<" and ">".
text = "If expenses < revenue then we have a profit, but if expenses > revenue then we have a loss."
Aws::Translate::Client.new.translate_text(text: text, source_language_code: 'en', target_language_code: 'fr').translated_text
=> "Si les dépenses sont < revenue then we have a profit, but if expenses > des recettes, nous avons une perte."
# Bad. Skips Translating text between "<" and ">".
text = "If expenses < revenue then we have a profit, but if expenses > revenue then we have a loss."
Aws::Translate::Client.new.translate_text(text: text, source_language_code: 'en', target_language_code: 'fr').translated_text
=> "Si les dépenses sont < revenue then we have a profit, but if expenses > des recettes, nous avons une perte."
Regression Issue
- Select this option if this issue appears to be a regression.
Expected Behavior
A. Do not return DNT ID values when there are extra < or > characters in the text.
B. Do not skip translating text between < and > characters.
Current Behavior
A. Returns "<DNT_..." value which wipes out some of the input text.
B. Skips translating text between < and > characters.
Reproduction Steps
# Returns internal DNT ID
Aws::Translate::Client.new.translate_text(text: '<<span translate="no">Skip me</span>', source_language_code: 'en', target_language_code: 'fr').translated_text
=> "<DNT_GEBKJMMFHEHCKOAJBKHKJHCAkDHDNDDD"
# Doesn't translate text between "<" and ">" characters
text = "If expenses < revenue then we have a profit, but if expenses > revenue then we have a loss."
Aws::Translate::Client.new.translate_text(text: text, source_language_code: 'en', target_language_code: 'fr').translated_text
=> "Si les dépenses sont < revenue then we have a profit, but if expenses > des recettes, nous avons une perte."
Possible Solution
No response
Additional Information/Context
No response
Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version
aws-sdk-translate (1.79.0)
Environment details (Version of Ruby, OS environment)
Ruby 3.2.6, macOS Sonoma 14.7.3
- Ngôn ngữ chính
- Ruby
- Star
- 3.7k
- Fork
- 1.2k
- Merge trung bình
- 1 ngày 16 giờ
- Pull request đã merge (30 ngày)
- 25
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/aws-sdk-ruby
-
service-api
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
aws/aws-sdk-ruby#3395 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
BedrockAgentCore: invoke_agent_runtime buffers entire response instead of streaming in real-timeĐang mởdocumentation p3 queued
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
aws/aws-sdk-ruby#3348 · 6 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
credentials static web identity credentials not picked up without an explicit profile optionĐang mởfeature-request needs-major-version
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
aws/aws-sdk-ruby#3241 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
investigating service-api
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
aws/aws-sdk-ruby#3217 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature-request
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
aws/aws-sdk-ruby#3190 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws/aws-sdk-ruby
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
lugassawan/swe-workbench#823 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
rubyjs/mini_racer#449 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
samvera/hyku#3446 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[BUG]: Export Donations button state not updatingCó thể đã có người làm @yashiyadav đã nhận hôm nay. Đang mở🐞 Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
rubyforgood/human-essentials#5744 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
paradigmxyz/centaur#2034 ·
Maintainer thường phản hồi trong vòng 1 ngày