diff options
| author | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2024-04-07 13:41:34 -0500 |
| commit | 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch) | |
| tree | f1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/html/global_attributes%2Ftranslate.html | |
new repository
Diffstat (limited to 'devdocs/html/global_attributes%2Ftranslate.html')
| -rw-r--r-- | devdocs/html/global_attributes%2Ftranslate.html | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/devdocs/html/global_attributes%2Ftranslate.html b/devdocs/html/global_attributes%2Ftranslate.html new file mode 100644 index 00000000..c9a58da7 --- /dev/null +++ b/devdocs/html/global_attributes%2Ftranslate.html @@ -0,0 +1,67 @@ +<header><h1>translate</h1></header><div class="section-content"> +<p>The <code>translate</code> <a href="../global_attributes">global attribute</a> is an <a href="https://developer.mozilla.org/en-US/docs/Glossary/Enumerated">enumerated</a> attribute that is used to specify whether an element's <em>translatable attribute</em> values and its <a href="https://developer.mozilla.org/en-US/docs/Web/API/Text"><code>Text</code></a> node children should be translated when the page is localized, or whether to leave them unchanged.</p> <p>It can have the following values:</p> <ul> <li>empty string or <code>yes</code>, which indicates that the element should be translated when the page is localized.</li> <li> +<code>no</code>, which indicates that the element must not be translated.</li> </ul> <p>Although not all browsers recognize this attribute, it is respected by automatic translation systems such as Google Translate, and may also be respected by tools used by human translators. As such it's important that web authors use this attribute to mark content that should not be translated.</p> +</div> +<h2 id="examples">Examples</h2> +<div class="section-content"> +<p>In this example, the <code>translate</code> attribute is used to ask translation tools not to translate the company's brand name in the footer.</p> <div class="code-example"> +<p class="example-header"><span class="language-name">html</span></p> +<pre data-signature="YUR8JX+HWnFFzd5xwMM0gCS0CxT53hVfauSW2dh1TGM=" data-language="html"><span class="token tag"><span class="token tag"><span class="token punctuation"><</span>footer</span><span class="token punctuation">></span></span> + <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>small</span><span class="token punctuation">></span></span>© 2020 <span class="token tag"><span class="token tag"><span class="token punctuation"><</span>span</span> <span class="token attr-name">translate</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">"</span>no<span class="token punctuation">"</span></span><span class="token punctuation">></span></span>BrandName<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>span</span><span class="token punctuation">></span></span><span class="token tag"><span class="token tag"><span class="token punctuation"></</span>small</span><span class="token punctuation">></span></span> +<span class="token tag"><span class="token tag"><span class="token punctuation"></</span>footer</span><span class="token punctuation">></span></span> +</pre> +</div> +</div> +<h2 id="specifications">Specifications</h2> +<div class="_table"><table class="standard-table"> +<thead><tr><th scope="col">Specification</th></tr></thead> +<tbody><tr><td><a href="https://html.spec.whatwg.org/multipage/dom.html#attr-translate">HTML Standard <br><small># attr-translate</small></a></td></tr></tbody> +</table></div> +<h2 id="browser_compatibility">Browser compatibility</h2> +<div class="_table"><table> +<thead> +<tr id="bct-browser-type"> +<th></th> +<th colspan="6">Desktop</th> +<th colspan="6">Mobile</th> +</tr> +<tr id="bct-browsers"> +<th></th> +<th>Chrome</th> +<th>Edge</th> +<th>Firefox</th> +<th>Internet Explorer</th> +<th>Opera</th> +<th>Safari</th> +<th>WebView Android</th> +<th>Chrome Android</th> +<th>Firefox for Android</th> +<th>Opera Android</th> +<th>Safari on IOS</th> +<th>Samsung Internet</th> +</tr> +</thead> +<tbody><tr> +<th><code>translate</code></th> +<td class="bc-supports-yes">19</td> +<td class="bc-supports-yes">79</td> +<td class="bc-supports-yes">111</td> +<td class="bc-supports-no">No</td> +<td class="bc-supports-yes">15</td> +<td class="bc-supports-yes">6</td> +<td class="bc-supports-yes">4.4</td> +<td class="bc-supports-yes">25</td> +<td class="bc-supports-yes">111</td> +<td class="bc-supports-yes">14</td> +<td class="bc-supports-yes">6</td> +<td class="bc-supports-yes">1.5</td> +</tr></tbody> +</table></div> +<h2 id="see_also">See also</h2> +<div class="section-content"><ul> <li>All <a href="../global_attributes">global attributes</a>.</li> <li>The <a class="page-not-created"><code>HTMLElement.translate</code></a> property that reflects this attribute.</li> <li> +<a href="https://www.w3.org/International/questions/qa-translate-flag" target="_blank">Using HTML's translate attribute</a>.</li> <li>HTML <a href="../global_attributes#lang"><code>lang</code></a> attribute</li> </ul></div><div class="_attribution"> + <p class="_attribution-p"> + © 2005–2023 MDN contributors.<br>Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.<br> + <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/translate" class="_attribution-link">https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/translate</a> + </p> +</div> |
