mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-17 16:26:39 +03:00
f539147d48
This fixes all the license headers in the main library, which corrects the appearance of the main license in the compiled output. It seems that the `!` in the header forces the compiler to keep it in the output. I believe older compiler releases did this purely based on `@license`. Issue #2638 Change-Id: I7f0e918caad10c9af689c9d07672b7fe9be7b2f3
41 lines
915 B
JavaScript
41 lines
915 B
JavaScript
/*! @license
|
|
* Shaka Player
|
|
* Copyright 2016 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
goog.provide('shaka.polyfill.Languages');
|
|
|
|
goog.require('shaka.polyfill');
|
|
|
|
|
|
/**
|
|
* @summary A polyfill to provide navigator.languages on all browsers.
|
|
* This is necessary for IE and possibly others we have yet to discover.
|
|
*/
|
|
shaka.polyfill.Languages = class {
|
|
/**
|
|
* Install the polyfill if needed.
|
|
*/
|
|
static install() {
|
|
if (navigator.languages) {
|
|
// No need.
|
|
return;
|
|
}
|
|
|
|
Object.defineProperty(navigator, 'languages', {
|
|
get: () => {
|
|
// If the browser provides a single language (all that we've seen), then
|
|
// make an array out of that. Otherwise, return English.
|
|
if (navigator.language) {
|
|
return [navigator.language];
|
|
}
|
|
return ['en'];
|
|
},
|
|
});
|
|
}
|
|
};
|
|
|
|
|
|
shaka.polyfill.register(shaka.polyfill.Languages.install);
|