Language fixes
This commit is contained in:
parent
27dc90ac3d
commit
a015b790b5
|
@ -35,9 +35,9 @@
|
|||
<ul pad-small>
|
||||
<li
|
||||
ng-repeat="lang in ::$ctrl.langs"
|
||||
name="{{::lang}}"
|
||||
ng-click="$ctrl.onChangeLangClick(lang)">
|
||||
<span>{{::lang}}</span>
|
||||
name="{{::lang.code}}"
|
||||
ng-click="$ctrl.onChangeLangClick(lang.code)">
|
||||
<span>{{::lang.name}}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</vn-menu>
|
||||
|
|
|
@ -1,6 +1,16 @@
|
|||
import ngModule from '../../module';
|
||||
import './style.scss';
|
||||
|
||||
let languages = {
|
||||
es: 'Español',
|
||||
en: 'English',
|
||||
ca: 'Català',
|
||||
pt: 'Português',
|
||||
fr: 'Français',
|
||||
nl: 'Nederlands',
|
||||
mn: 'Монгол хэл'
|
||||
};
|
||||
|
||||
export default class MainMenu {
|
||||
constructor($translate, $scope, $http, $window, modulesFactory) {
|
||||
this.$ = $scope;
|
||||
|
@ -8,8 +18,15 @@ export default class MainMenu {
|
|||
this.$translate = $translate;
|
||||
this.$window = $window;
|
||||
this.modules = modulesFactory.getModules();
|
||||
this.langs = $translate.getAvailableLanguageKeys();
|
||||
this.langs = [];
|
||||
|
||||
for (var code of $translate.getAvailableLanguageKeys())
|
||||
this.langs.push({
|
||||
code: code,
|
||||
name: languages[code] ? languages[code] : code
|
||||
});
|
||||
}
|
||||
|
||||
getCurrentUserName() {
|
||||
this.$http.get('/auth/api/Accounts/getCurrentUserName')
|
||||
.then(json => {
|
||||
|
@ -20,9 +37,11 @@ export default class MainMenu {
|
|||
onLogoutClick() {
|
||||
this.$window.location = '/logout';
|
||||
}
|
||||
|
||||
onChangeLangClick(lang) {
|
||||
this.$translate.use(lang);
|
||||
}
|
||||
|
||||
$onInit() {
|
||||
this.getCurrentUserName();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue