diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/ja/web/api/audiotrack/language | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/ja/web/api/audiotrack/language')
-rw-r--r-- | files/ja/web/api/audiotrack/language/index.html | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/files/ja/web/api/audiotrack/language/index.html b/files/ja/web/api/audiotrack/language/index.html new file mode 100644 index 0000000000..32a37615e7 --- /dev/null +++ b/files/ja/web/api/audiotrack/language/index.html @@ -0,0 +1,88 @@ +--- +title: AudioTrack.language +slug: Web/API/AudioTrack/language +tags: + - API + - Audio + - AudioTrack + - HTML DOM + - Language + - Localization + - Media + - Property + - Read-only + - Reference + - Translated + - Translation + - track +translation_of: Web/API/AudioTrack/language +--- +<div>{{APIRef("HTML DOM")}}</div> + +<p><span class="seoSummary">読み取り専用の <strong>{{domxref("AudioTrack")}}</strong> の <strong><code>language</code></strong> プロパティは、音声トラックで使用されている言語を識別する文字列を返します。</span> 複数の言語を含むトラック(他の言語で数行が話されている英語の映画など)の場合は、これが動画の主要言語になります。</p> + +<h2 id="Syntax" name="Syntax">構文</h2> + +<pre class="syntaxbox">var <em>audioTrackLanguage</em> = <em>AudioTrack</em>.language;</pre> + +<h3 id="Value" name="Value">値</h3> + +<p>音声トラックで使用される主要言語の BCP 47({{RFC(5646)}})形式の言語タグを指定する {{domxref("DOMString")}}。 言語が指定されていないか知られていない場合や、トラックにスピーチが含まれていない場合は空文字列(<code>""</code>)。</p> + +<p>例えば、トラックで使用されている主要言語がアメリカ英語の場合、この値は <code>"en-US"</code> になります。 ブラジルポルトガル語の場合、値は <code>"pt-BR"</code> になります。</p> + +<h2 id="Example" name="Example">例</h2> + +<p>この例では、メディア要素の主要言語と翻訳された音声トラックのすべてを検索し、それらの各トラックの {{domxref("AudioTrack.id", "id")}}、{{domxref("AudioTrack.kind", "kind")}}、<code>language</code> を含むオブジェクトのリストを返します。</p> + +<p>これは、例えば、映画を見ながら、ユーザーが聞きたい言語を選択するためのユーザーインターフェイスを構築するために使用できます。</p> + +<div class="codecopy codecopy-lg"> +<pre class="brush: js line-numbers language-js"><code class="language-js"><span class="keyword token">function</span> getAvailableLanguages<span class="punctuation token">(</span>el<span class="punctuation token">)</span> <span class="punctuation token">{</span> + <span class="keyword token">var</span> trackList <span class="operator token">=</span> <span class="punctuation token">[</span><span class="punctuation token">]</span><span class="punctuation token">;</span> + <span class="keyword token">const</span> wantedKinds <span class="operator token">=</span> <span class="punctuation token">[</span> + <span class="string token">"main"</span><span class="punctuation token">,</span> <span class="string token">"translation"</span> + <span class="punctuation token">]</span><span class="punctuation token">;</span> + + el<span class="punctuation token">.</span>audioTracks<span class="punctuation token">.</span><span class="function token">forEach</span><span class="punctuation token">(</span><span class="keyword token">function</span><span class="punctuation token">(</span>track<span class="punctuation token">)</span> <span class="punctuation token">{</span> + <span class="keyword token">if</span> <span class="punctuation token">(</span>wantedKinds<span class="punctuation token">.</span><span class="function token">includes</span><span class="punctuation token">(</span>track<span class="punctuation token">.</span>kind<span class="punctuation token">)</span><span class="punctuation token">)</span> <span class="punctuation token">{</span> + trackList<span class="punctuation token">.</span><span class="function token">push</span><span class="punctuation token">(</span><span class="punctuation token">{</span> + id<span class="punctuation token">:</span> track<span class="punctuation token">.</span>id<span class="punctuation token">,</span> + kind<span class="punctuation token">:</span> track<span class="punctuation token">.</span>kind<span class="punctuation token">,</span> + language<span class="punctuation token">:</span> track<span class="punctuation token">.language</span> + <span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">;</span> + <span class="punctuation token">}</span> + <span class="punctuation token">}</span><span class="punctuation token">)</span><span class="punctuation token">;</span> + <span class="keyword token">return</span> trackList<span class="punctuation token">;</span> +<span class="punctuation token">}</span></code></pre> + +<h2 id="Specifications" name="Specifications">仕様</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">仕様</th> + <th scope="col">状態</th> + <th scope="col">コメント</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', 'media.html#dom-audiotrack-language', 'AudioTrack.language')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('HTML5 W3C', 'embedded-content-0.html#dom-audiotrack-language', 'AudioTrack.language')}}</td> + <td>{{Spec2('HTML5 W3C')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2> + + + +<p>{{Compat("api.AudioTrack.language")}}</p> +</div> |