Bugzilla – Bug 20853
WebVTT: WebVTT files should have a default language
Last modified: 2014-01-28 06:44:47 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
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.
(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.
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.
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.