[7] [[HTML]] の [DFN[[CODE(HTMLa)@en[[[translate]]]] [[属性]]]]は、その[[要素]]の[[属性]]と[[内容]]を翻訳できるかどうかを表します。

* 仕様書

[REFS[
- [6] [CITE@en-US-x-hixie[HTML Standard]] ([TIME[2013-11-22 20:38:38 +09:00]] 版) <http://www.whatwg.org/specs/web-apps/current-work/#the-translate-attribute>
]REFS]

* 翻訳可能属性

[8] [[属性]]は、その種類によって翻訳するべきものとしないべきものがあります。例えば [CODE(HTMLa)@en[[[title]]]]
[[属性]]は翻訳するべきですが、 [CODE(HTMLa)@en[[[class]]]] [[属性]]は翻訳するべきではありません。
翻訳するべき[[属性]]のことを[DFN[[RUBYB[翻訳可能属性]@en[translatable attribute]]]]といいます。

[9] ある[[属性]]が翻訳可能かどうかは、当該[[属性]]の仕様 ([[HTML]] の場合は >>6) で規定されています。

[11] [[翻訳可能属性]]の中には、条件付きのものもあります。例えば [CODE(HTMLe)@en[[[input]]]] [[要素]]の 
[CODE(HTMLa)@en[[[value]]]] [[属性]]は、 [CODE(HTMLa)@en[[[type]]]] [[属性]]が [CODE(HTML)@en[[[button]]]]
か [CODE(HTML)@en[[[reset]]]]
の時のみ翻訳可能です。また、 [CODE(HTMLe)@en[[[iframe]]]] [[要素]]の [CODE(HTMLa)@en[[[srcdoc]]]]
[[属性]]の値は [[HTML文書]]なので、再帰的に構文解析して翻訳可能な部分を探す必要があります。

[10] [[翻訳可能属性]]の[[機械可読]]な一覧データは <https://raw.github.com/manakai/data-web-defs/master/data/elements.json> にあります。

* 歴史

** 90年代

[16] [[90年代]]中期の[[日本]]では、 [[Netscape Navigator]] や [[Internet Explorer]]
と連動して[[翻訳]]を行う製品が存在していました。当時は有料や別売りだった [[NN]] や [[IE]]
を同梱したパッケージ製品もありました。

[17] それらは、 [[Webブラウザー]]と連動する独自の[[アプリケーション]]を使って[[翻訳]]結果を表示したり、
[[プロキシ]]として動作して [[Webブラウザー]]内部に (結果のみ、ページ内併記、あるいは[[フレーム]]による併記などの方法で) [[翻訳]]結果を表示するものでした。

[18] この時代には数製品発売されていましたが、
[[日本語]] [[Webサイト]]の充実で需要が減少したのか、
数年でブームは去ったようです。

** HTML Standard

[19] 10年代になって [[Chrome]] が標準で[[翻訳]]機能を実装しました。
これは表示中の [[Webページ]]を[[翻訳]]して ([[DOM]] 上のテキストを置き換えて)
表示するものです。

[20] [[著者]]が[[翻訳]]の有無を制御する必要が生じたことから、
[[HTML]] に [CODE(HTMLa)@en[[[translate]]]] [[属性]]が追加されました。

[1] [CITE@en[Web Applications 1.0 r6971    Introduce a new global attribute for localisers to tell whether or not content should be translated.]]
( ([TIME[2012-02-07 09:22:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=6970&to=6971>

[2] [CITE[''''''[''''''whatwg'''''']'''''' Machine translation and related proposals]]
( ([TIME[2012-06-12 07:33:54 +09:00]] 版))
<http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2012-June/036354.html>

[3] [CITE@en[Web Applications 1.0 r7745  Clean up some translation-related things.]]
( ([TIME[2013-03-09 08:38:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=7744&to=7745>

[4] [CITE@en[Web Applications 1.0 r8276  Mention that other specs may also list translatable attributes.]]
( ([TIME[2013-11-14 06:01:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=8275&to=8276>

[5] [CITE@en[Web Applications 1.0 r8311  Allow <input type=button value> to be translated, since that value isn't submitted]]
( ([TIME[2013-11-23 05:22:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=8310&to=8311>

[12] [CITE@en[Web Applications 1.0 r8322 Reset buttons also don't get submitted, so it's probably safe to translate them too.]]
( ([TIME[2013-12-03 08:07:00 +09:00]] 版))
<http://html5.org/tools/web-apps-tracker?from=8321&to=8322>


[13] [CITE@en-US[Internationalization Tag Set (ITS) Version 2.0]]
( ([TIME[2013-10-27 19:39:43 +09:00]] 版))
<http://www.w3.org/TR/its20/#translatability-implementation>

[14] [CITE@en[Doc: Using translate directive]]
([TIME[2015-02-09 04:30:02 +09:00]] 版)
<http://angular-translate.github.io/docs/#/guide/05_using-translate-directive>

[FIG(quote)[
[FIGCAPTION[
[15] [CITE@en[angular-gettext - Super-simple translation support for Angular]]
([TIME[2015-01-13 19:51:31 +09:00]] 版)
<https://angular-gettext.rocketeer.be/>
]FIGCAPTION]

> <a href="/" translate>Home</a>

]FIG]


[21] [CITE@en[17954 – Attribute to indicate that the grammar should be translated (e.g. apply declensions), but that the base of the words should remain in the original language]]
([TIME[2016-03-17 16:58:31 +09:00]] 版)
<https://www.w3.org/Bugs/Public/show_bug.cgi?id=17954>

[22] [CITE@en[Editorial: synchronize with the DOM Standard · whatwg/html@21c6ec7]]
([TIME[2016-03-20 18:07:11 +09:00]] 版)
<https://github.com/whatwg/html/commit/21c6ec77594eb89b836d4872222f5916910967fd>

[23] [CITE@en[Editorial: always state invalid value default]]
([[GloverDonovan]]著, [TIME[2018-03-05 13:36:29 +09:00]])
<https://github.com/whatwg/html/commit/7e941ae96b264d4743ea0afac00c3b3209ab0cde>


[24] 
[[Google Chrome]]
の[[翻訳]]機能はテキストを翻訳するだけで
[[bidi]]
の調整はしないようです。
[[アラビア語]]を[[英語]]に翻訳すると、
[[右横書き]]モードのままで、
[[句読点]]が変な位置に表示されます。
[TIME[2020-10-29T01:59:16.400Z]]