Bug 20853 - WebVTT: WebVTT files should have a default language
WebVTT: WebVTT files should have a default language
Product: TextTracks CG
Classification: Unclassified
Component: WebVTT
PC All
: P2 normal
: ---
Assigned To: Silvia Pfeiffer
This bug has no owner yet - up for the taking
Depends on: 15922
  Show dependency treegraph
Reported: 2013-02-02 07:08 UTC by Silvia Pfeiffer
Modified: 2014-01-28 06:44 UTC (History)
7 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Silvia Pfeiffer 2013-02-02 07:08:40 UTC
As discussed in bug 15922 , the :lang() selector used on a WebVTT file's cues that have no <lang> markup can't match anything.

This leads back to the need to specify file-level language.

One way to fix this is to take the implicit assumption that if the WebVTT file was pulled in via a <track ... @srclang attribute, that @srclang is the default language of the WebVTT file and can be used in :lang() selections, e.g. when all text on a video in a particular language requires specific styling. Providing <lang> markers for every single cue just to set the default language seems overkill.

This further leads on to specifying the language of the WebVTT file in the file itself for those applications that don't display the WebVTT file in a browser e.g. as in


   cue id
   00:00:00.000 --> 00:00:01.000

IMO this file-wide metadata field can be ignored by the Web browser, since the Web browser relies on @srclang in <track>. So, this is just a hint for other WebVTT consuming clients.
Comment 1 Dima Gorbik 2013-02-02 07:35:43 UTC
(In reply to comment #0)
This is cool, we could just have this "file-level" language pushed onto the language stack so that it's never empty. Should be really easy in terms of implementation.
Comment 2 David Singer 2013-03-19 21:35:38 UTC
Rather than saying that file-level attributes can be ignored by a browser, I think it cleaner to say that the HTML level takes precedence if something is in both places and can be specified only once.  This leaves open then the possibility of both inheriting style sheets from the browser context, and also having one (e.g. to do x08-like effects) specified for the VTT only.
Comment 3 Philip Jägenstedt 2014-01-28 05:36:58 UTC
Making the :lang() selector do something does not require language metadata in the file itself, hooking it up with TextTrack.language would suffice.

However, this bug does not explain *why* there needs to be a default language that :lang() can match. That would just match everything that isn't in <lang>, which can just as well be done with the ::cue() pseudo-element, having :lang() override that default style where needed.

If reopened, I think this should still be v2, and that we should wait for Web authors in the trenches to request this before adding it.