The rules for sourcing out-of-band text tracks require access to the user's preferred language. For example: If the text track kind is subtitles or captions and the user has indicated an interest in having a track with this text track kind, text track language, and text track label enabled, and there is no other text track in the media element's list of text tracks with a text track kind of either subtitles or captions whose text track mode is showing http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#sourcing-out-of-band-text-tracks On OS X, at least, the preference is an ordered list of languages.
<rdar://problem/10551005>
Created attachment 125015 [details] Proposed patch
Comment on attachment 125015 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=125015&action=review > Source/WebCore/html/HTMLMediaElement.cpp:2365 > + // ... ? > Source/WebCore/platform/Language.cpp:93 > + if (lowercaseLanguageCode.length() >= 3 && lowercaseLanguageCode[2] == '_') > + lowercaseLanguageCode.replace(2, 1, "-"); Don't we want to use CoreFoundation to canonicalize? AppleLanguages can contains things like "English" on some systems.
(In reply to comment #3) > (From update of attachment 125015 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=125015&action=review > > > Source/WebCore/html/HTMLMediaElement.cpp:2365 > > + // ... > > ? I was tryingo indicate that the text is not the first thing after the section label. I can remove it if it is confusing. > > > Source/WebCore/platform/Language.cpp:93 > > + if (lowercaseLanguageCode.length() >= 3 && lowercaseLanguageCode[2] == '_') > > + lowercaseLanguageCode.replace(2, 1, "-"); > > Don't we want to use CoreFoundation to canonicalize? AppleLanguages can contains things like "English" on some systems. Maybe. This is how we canonicalize language codes returned by AppleLanguages in createHTTPStyleLanguageCode (Languages.mm). Do you know if we have had an reports of problems with that code? Thanks for the quick review!
> Maybe. This is how we canonicalize language codes returned by AppleLanguages in createHTTPStyleLanguageCode (Languages.mm). Do you know if we have had an reports of problems with that code? No, none that I would remember.
(In reply to comment #5) > > Maybe. This is how we canonicalize language codes returned by AppleLanguages in createHTTPStyleLanguageCode (Languages.mm). Do you know if we have had an reports of problems with that code? > > No, none that I would remember. OK, lets keep an eye out and problem show up I will add a platform specific version.
http://trac.webkit.org/changeset/106531