[ACA-968] Language Picker

This commit is contained in:
Cilibiu Bogdan
2017-11-02 18:48:37 +02:00
committed by Denys Vuika
parent c3f8724a23
commit 7007c735e4
4 changed files with 63 additions and 3 deletions

View File

@@ -4,6 +4,7 @@
"name": "Alfresco Example Content Application", "name": "Alfresco Example Content Application",
"build": "1234" "build": "1234"
}, },
"languagePicker": false,
"document-list": { "document-list": {
"supportedPageSizes": [ "supportedPageSizes": [
25, 25,
@@ -18,5 +19,47 @@
"thumbs.db", "thumbs.db",
".git" ".git"
] ]
},
"languages": [
{
"key": "de",
"label": "German"
},
{
"key": "en",
"label": "English"
},
{
"key": "es",
"label": "Spanish"
},
{
"key": "fr",
"label": "French"
},
{
"key": "it",
"label": "Italian"
},
{
"key": "ja",
"label": "Japanese"
},
{
"key": "nb",
"label": "Norwegian"
},
{
"key": "nl",
"label": "Dutch"
},
{
"key": "pt-BR",
"label": "Brazilian Portuguese"
},
{
"key": "ru",
"label": "Russian"
} }
]
} }

View File

@@ -11,8 +11,17 @@
</div> </div>
<mat-menu #userMenu="matMenu" [overlapTrigger]="false"> <mat-menu #userMenu="matMenu" [overlapTrigger]="false">
<button *ngIf="showLanguagePicker"
mat-menu-item [matMenuTriggerFor]="langMenu">
{{ 'APP.LANGUAGE' | translate }}
</button>
<button mat-menu-item adf-logout> <button mat-menu-item adf-logout>
{{ 'APP.SIGN_OUT' | translate }} {{ 'APP.SIGN_OUT' | translate }}
</button> </button>
</mat-menu> </mat-menu>
<mat-menu #langMenu="matMenu">
<adf-language-menu></adf-language-menu>
</mat-menu>
</div> </div>

View File

@@ -16,7 +16,7 @@
*/ */
import { Component, OnInit, OnDestroy } from '@angular/core'; import { Component, OnInit, OnDestroy } from '@angular/core';
import { PeopleContentService } from 'ng2-alfresco-core'; import { PeopleContentService, AppConfigService } from 'ng2-alfresco-core';
import { Subscription } from 'rxjs/Rx'; import { Subscription } from 'rxjs/Rx';
@Component({ @Component({
@@ -29,7 +29,10 @@ export class CurrentUserComponent implements OnInit, OnDestroy {
user: any = null; user: any = null;
constructor(private peopleApi: PeopleContentService) {} constructor(
private peopleApi: PeopleContentService,
private appConfig: AppConfigService
) {}
ngOnInit() { ngOnInit() {
this.personSubscription = this.peopleApi.getCurrentPerson() this.personSubscription = this.peopleApi.getCurrentPerson()
@@ -61,4 +64,8 @@ export class CurrentUserComponent implements OnInit, OnDestroy {
const { userFirstName: first, userLastName: last } = this; const { userFirstName: first, userLastName: last } = this;
return [ first[0], last[0] ].join(''); return [ first[0], last[0] ].join('');
} }
get showLanguagePicker() {
return this.appConfig.get('languagePicker') || false;
}
} }

View File

@@ -1,5 +1,6 @@
{ {
"APP": { "APP": {
"LANGUAGE": "Language",
"SIGN_IN": "Sign in", "SIGN_IN": "Sign in",
"SIGN_OUT": "Sign out", "SIGN_OUT": "Sign out",
"NEW_MENU": { "NEW_MENU": {