Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Aws::Translate::Client - translate_text Returns Random Do-Not-Translate IDs or Skips Translations Depending on < and > Character Usage

オープン
#3,191 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
aws, ruby
領域
api, cloud

調査の方向性

リポジトリのファイルもテストも特定されていません。aws-sdk-translate 1.79.0 を使って2つの Ruby の再現を再実行し、クライアントのリクエストと AWS Translate のレスポンスを比較して、欠陥がサービス側にあるのかクライアント側にあるのかを明らかにします。完了とは、担当箇所が確認され、DNT IDs とスキップされたテキストの挙動が解決または文書化されていることを意味します。

索引モデルが issue の本文から書いたものです。

説明

service-api
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 &lt; and &gt; 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 &lt; revenue then we have a profit, but if expenses &gt; 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 &lt; and &gt; characters.

Current Behavior

A. Returns "<DNT_..." value which wipes out some of the input text.
B. Skips translating text between &lt; and &gt; 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 &lt; revenue then we have a profit, but if expenses &gt; 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

主要言語
Ruby
スター
3.7k
フォーク
1.2k
平均マージ
1日 16時間
マージ済み PR(30日)
25

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

aws/aws-sdk-ruby のほかの issue

aws/aws-sdk-ruby の issue をすべて見る

似ている issue

Ruby の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。