UNPKG

armisa-models

Version:
49 lines (48 loc) 1.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Languages = void 0; const GetAll_1 = require("./Language/GetAll"); class Languages { selectThisLanguage(language) { this.current = language; this.languageSuffix = this.current.name === 'Persian' ? 'FA' : this.current.name === 'Arabic' ? 'AR' : this.current.name === 'France' ? 'FR' : this.current.name === 'Spanish' ? 'SP' : 'EN'; localStorage.setItem('language', this.languageSuffix); } get isRightToLeft() { return this.current?.isRightToLeft || false; } get Current() { return this.current; } constructor(mainStateManager) { this.mainStateManager = mainStateManager; this.forceUpdate = () => { }; this.languageSuffix = 'FA'; this.Items = []; this.onChangeLanguage = (callBack) => this.getAllLanguages.on('change', callBack); this.loadItems = () => { this.forceUpdate(); this.getAllLanguages = GetAll_1.GetAllFactory.buildNew(this.mainStateManager); this.getAllLanguages.on('form.wasErrored', () => { this.forceUpdate(); }); this.getAllLanguages.on('form.wasLoaded', () => { // this.mainStateManager.isAmisa = this.getAllLanguages!.get('isAmisa'); this.Items = this.getAllLanguages.get('languages'); this.current = this.Items[0]; this.forceUpdate(); }); // this.getAllLanguages.startToLoad(); }; } } exports.Languages = Languages;