mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-14 11:44:54 +08:00
29 lines
665 B
JavaScript
29 lines
665 B
JavaScript
import ko from 'ko';
|
|
|
|
import { convertLangName } from 'Common/Translator';
|
|
|
|
import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
|
|
|
export class LanguagesPopupView extends AbstractViewPopup {
|
|
constructor() {
|
|
super('Languages');
|
|
this.fLang = null;
|
|
this.languages = ko.observableArray();
|
|
}
|
|
|
|
onShow(fLanguage, langs, userLanguage) {
|
|
this.fLang = fLanguage;
|
|
this.languages(langs.map(language => ({
|
|
key: language,
|
|
user: userLanguage === language,
|
|
selected: fLanguage?.() === language,
|
|
fullName: convertLangName(language),
|
|
title: convertLangName(language, true)
|
|
})));
|
|
}
|
|
|
|
changeLanguage(lang) {
|
|
this.fLang?.(lang);
|
|
this.close();
|
|
}
|
|
}
|