This repository has been archived on 2026-01-08. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
plyr/src/js/i18n.js
T
2018-05-30 17:02:07 +02:00

36 lines
826 B
JavaScript

// ==========================================================================
// Plyr internationalization
// ==========================================================================
import utils from './utils';
const i18n = {
get(key = '', config = {}) {
if (utils.is.empty(key) || utils.is.empty(config)) {
return '';
}
let string = utils.getDeep(config.i18n, key);
if (utils.is.empty(string)) {
return '';
}
const replace = {
'{seektime}': config.seekTime,
'{title}': config.title,
};
Object.entries(replace).forEach(([
key,
value,
]) => {
string = utils.replaceAll(string, key, value);
});
return string;
},
};
export default i18n;