main
1import translations from 'i18n.json'; /* eslint-disable-line import/no-unresolved */
2
3export default class {
4 translate(key) {
5 return this.constructor.translate(key);
6 }
7
8 static translate(key) {
9 return translations[this.locale][key];
10 }
11
12 static get locale() {
13 const html = document.querySelector('html');
14 return html.getAttribute('lang') || 'en';
15 }
16}