diff options
author | Philip Giuliani <philip.giuliani@keepinmind.info> | 2018-05-30 14:55:48 +0200 |
---|---|---|
committer | Philip Giuliani <philip.giuliani@keepinmind.info> | 2018-05-30 17:02:07 +0200 |
commit | 1c1668bfc344a21e2039527f70034ba4ecb68dfd (patch) | |
tree | f31a67e3045b87cdaa0210fcd827f891c2f5daac /src/js/controls.js | |
parent | e0c09c51f292062ca8dae679990465763434adb1 (diff) | |
download | plyr-1c1668bfc344a21e2039527f70034ba4ecb68dfd.tar.lz plyr-1c1668bfc344a21e2039527f70034ba4ecb68dfd.tar.xz plyr-1c1668bfc344a21e2039527f70034ba4ecb68dfd.zip |
Implement translation support for qualityName and qualityBadge
Diffstat (limited to 'src/js/controls.js')
-rw-r--r-- | src/js/controls.js | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/src/js/controls.js b/src/js/controls.js index 32e82f78..72b752c1 100644 --- a/src/js/controls.js +++ b/src/js/controls.js @@ -664,27 +664,7 @@ const controls = { // Get the badge HTML for HD, 4K etc const getBadge = quality => { - let label = ''; - - switch (quality) { - case 2160: - label = '4K'; - break; - - case 1440: - case 1080: - case 720: - label = 'HD'; - break; - - case 576: - case 480: - label = 'SD'; - break; - - default: - break; - } + const label = i18n.get(`qualityBadge.${quality}`, this.config); if (!label.length) { return null; @@ -708,7 +688,6 @@ const controls = { }, // Translate a value into a nice label - // TODO: Localisation getLabel(setting, value) { switch (setting) { case 'speed': @@ -716,7 +695,13 @@ const controls = { case 'quality': if (utils.is.number(value)) { - return `${value}p`; + const qualityName = i18n.get(`qualityName.${value}`, this.config); + + if (!qualityName.length) { + return `${value}p`; + } + + return qualityName; } return utils.toTitleCase(value); |