mirror of
https://github.com/braver/programmingfonts.git
synced 2024-09-08 12:41:32 +02:00
23 lines
429 B
JavaScript
23 lines
429 B
JavaScript
import { Cookies } from './cookies.js'
|
|
|
|
export class Language {
|
|
el = document.getElementById('select-language')
|
|
|
|
init () {
|
|
if (Cookies.get('language')) {
|
|
this.el.value = Cookies.get('language')
|
|
}
|
|
this.el.onchange = () => {
|
|
this.set()
|
|
}
|
|
this.set()
|
|
}
|
|
|
|
set () {
|
|
const lang = this.el.value
|
|
|
|
window.CMeditor.setOption('mode', lang.toLowerCase())
|
|
Cookies.set('language', lang)
|
|
}
|
|
}
|