diff --git a/projects/ucap-webmessenger-app/src/app/app-provider.module.ts b/projects/ucap-webmessenger-app/src/app/app-provider.module.ts index 6d24c2e8..5205cc2f 100644 --- a/projects/ucap-webmessenger-app/src/app/app-provider.module.ts +++ b/projects/ucap-webmessenger-app/src/app/app-provider.module.ts @@ -11,6 +11,9 @@ import { AppService } from './services/app.service'; import { environment } from '../environments/environment'; import { BrowserNativeService } from '@ucap-webmessenger/native-browser'; import { ElectronNativeService } from '@ucap-webmessenger/native-electron'; +import { MatPaginatorIntl, MatPaginatorModule } from '@angular/material'; +import { PaginatorIntlService } from '@ucap-webmessenger/ui'; +import { TranslateService } from '@ngx-translate/core'; export function initializeApp( appService: AppService, @@ -22,7 +25,7 @@ export function initializeApp( } @NgModule({ - imports: [], + imports: [MatPaginatorModule], exports: [], providers: [ { @@ -34,6 +37,10 @@ export function initializeApp( : ElectronNativeService, deps: [HttpClient] }, + { + provide: MatPaginatorIntl, + useClass: PaginatorIntlService + }, ...SERVICES, ...RESOLVERS, { diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html index e78fbdc3..762944e2 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/left-sidenav/group.component.html @@ -177,10 +177,12 @@ " (click)="onClickProfileContextMenu('REGISTER_FAVORITE', userInfo)" > - 즐겨찾기 {{ userInfo.isFavorit ? '해제' : '등록' }} + {{ + (userInfo.isFavorit ? 'group.unfavorite' : 'group.favorite') | translate + }} {{ element.info.size | ucapBytes }} @@ -242,14 +257,14 @@ class="mat-primary" (click)="onClickDownloadAll()" > - Download All + {{ 'common.file.downloadSelected' | translate }} diff --git a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/file-box.component.ts b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/file-box.component.ts index 38ded6e3..15949135 100644 --- a/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/file-box.component.ts +++ b/projects/ucap-webmessenger-app/src/app/layouts/messenger/components/right-drawer/file-box.component.ts @@ -39,6 +39,7 @@ import { KEY_ENVIRONMENTS_INFO } from '@app/types'; import { RoomInfo } from '@ucap-webmessenger/protocol-room'; +import { TranslateService } from '@ngx-translate/core'; export interface FileInfoTotal { info: FileInfo; @@ -75,6 +76,7 @@ export class FileBoxComponent implements OnInit, OnDestroy { private store: Store, private sessionStorageService: SessionStorageService, private commonApiService: CommonApiService, + private translateService: TranslateService, private snackBarService: SnackBarService, @Inject(UCAP_NATIVE_SERVICE) private nativeService: NativeService, private dialogService: DialogService, @@ -274,26 +276,33 @@ export class FileBoxComponent implements OnInit, OnDestroy { .saveFile(buffer, fileInfo.info.name, mimeType) .then(result => { if (!!result) { - this.snackBarService.open( - `파일이 경로[${result}]에 저장되었습니다.`, - '', - { - duration: 3000, - verticalPosition: 'bottom' - } - ); + this.translateService + .get('common.file.savedToPath', { + v: result + }) + .pipe(take(1)) + .subscribe(v => { + this.snackBarService.open(v, '', { + duration: 3000, + verticalPosition: 'bottom' + }); + }); } else { - this.snackBarService.open( - '파일 저장에 실패하였습니다.', - '확인' - ); + this.translateService + .get('common.file.failToSave') + .pipe(take(1)) + .subscribe(v => { + this.snackBarService.open(v); + }); } }) .catch(reason => { - this.snackBarService.open( - '파일 저장에 실패하였습니다.', - '확인' - ); + this.translateService + .get('common.file.failToSave') + .pipe(take(1)) + .subscribe(v => { + this.snackBarService.open(v); + }); }); }) .catch(reason => { @@ -343,74 +352,84 @@ export class FileBoxComponent implements OnInit, OnDestroy { ); } - async onClickForward(fileInfo: FileInfoTotal) { - const result = await this.dialogService.open< - CreateChatDialogComponent, - CreateChatDialogData, - CreateChatDialogResult - >(CreateChatDialogComponent, { - width: '600px', - data: { - type: UserSelectDialogType.MessageForward, - title: 'MessageForward', - ignoreRoom: [this.roomInfo] - } - }); + onClickForward(fileInfo: FileInfoTotal) { + this.translateService + .get('chat.forwardFileTo') + .pipe(take(1)) + .subscribe(async v => { + const result = await this.dialogService.open< + CreateChatDialogComponent, + CreateChatDialogData, + CreateChatDialogResult + >(CreateChatDialogComponent, { + width: '600px', + data: { + type: UserSelectDialogType.MessageForward, + title: v, + ignoreRoom: [this.roomInfo] + } + }); - if (!!result && !!result.choice && result.choice) { - const userSeqs: number[] = []; - let roomSeq = ''; - if (!!result.selectedUserList && result.selectedUserList.length > 0) { - result.selectedUserList.map(user => userSeqs.push(user.seq)); - } + if (!!result && !!result.choice && result.choice) { + const userSeqs: number[] = []; + let roomSeq = ''; + if (!!result.selectedUserList && result.selectedUserList.length > 0) { + result.selectedUserList.map(user => userSeqs.push(user.seq)); + } - if (!!result.selectedRoom) { - roomSeq = result.selectedRoom.roomSeq; - } + if (!!result.selectedRoom) { + roomSeq = result.selectedRoom.roomSeq; + } - if (userSeqs.length > 0 || roomSeq.trim().length > 0) { - this.store.dispatch( - EventStore.forward({ - senderSeq: this.loginRes.userSeq, - req: { - roomSeq: '-999', - eventType: EventType.File, - sentMessage: fileInfo.info.sentMessage - }, - trgtUserSeqs: userSeqs, - trgtRoomSeq: roomSeq - }) - ); - } - } + if (userSeqs.length > 0 || roomSeq.trim().length > 0) { + this.store.dispatch( + EventStore.forward({ + senderSeq: this.loginRes.userSeq, + req: { + roomSeq: '-999', + eventType: EventType.File, + sentMessage: fileInfo.info.sentMessage + }, + trgtUserSeqs: userSeqs, + trgtRoomSeq: roomSeq + }) + ); + } + } + }); } - async onClickDelete(fileInfo: FileInfoTotal) { - const result = await this.dialogService.open< - ConfirmDialogComponent, - ConfirmDialogData, - ConfirmDialogResult - >(ConfirmDialogComponent, { - width: '400px', - data: { - title: 'Delete', - html: `선택한 파일(메시지)를 삭제하시겠습니까?
삭제된 파일(메시지)는 내 대화방에서만 적용되며 상대방의 대화방에서는 삭제되지 않습니다.` - } - }); + onClickDelete(fileInfo: FileInfoTotal) { + this.translateService + .get('chat.confirmDeleteFile') + .pipe(take(1)) + .subscribe(async v => { + const result = await this.dialogService.open< + ConfirmDialogComponent, + ConfirmDialogData, + ConfirmDialogResult + >(ConfirmDialogComponent, { + width: '400px', + data: { + title: 'Delete', + html: v + } + }); - if (!!result && !!result.choice && result.choice) { - this.store.dispatch( - EventStore.del({ - roomSeq: this.roomInfo.roomSeq, - eventSeq: fileInfo.info.eventSeq - }) - ); + if (!!result && !!result.choice && result.choice) { + this.store.dispatch( + EventStore.del({ + roomSeq: this.roomInfo.roomSeq, + eventSeq: fileInfo.info.eventSeq + }) + ); - this.fileInfoTotal = this.fileInfoTotal.filter( - fInfo => fInfo.info.seq !== fileInfo.info.seq - ); - this.onSelectedIndexChange(this.currentTabIndex); - } + this.fileInfoTotal = this.fileInfoTotal.filter( + fInfo => fInfo.info.seq !== fileInfo.info.seq + ); + this.onSelectedIndexChange(this.currentTabIndex); + } + }); } get fileRetentionPeriodOptions(): DateOptions { diff --git a/projects/ucap-webmessenger-app/src/assets/i18n/en.json b/projects/ucap-webmessenger-app/src/assets/i18n/en.json index fef90062..e3c1a243 100644 --- a/projects/ucap-webmessenger-app/src/assets/i18n/en.json +++ b/projects/ucap-webmessenger-app/src/assets/i18n/en.json @@ -6,14 +6,36 @@ "useOnlyForSpecialCharacter": "Can only use Special characters: {{v}}", "howManyPersons": "person(s)", "file": { + "name": "Name of file", + "size": "Size of file", + "download": "Download", + "delete": "Delete", "saved": "The file has been saved.", "savedToPath": "The file has been saved to path[{{v}}].", - "failToSave": "File save failed." + "failToSave": "File save failed.", + "downloadSelected": "Download selected", + "openDownloadFolder": "Open download folder", + "selectFiles": "Select files", + "type": { + "label": "Type of file", + "images": "Images", + "video": "Video" + } }, "messages": { "yes": "Yes", "no": "No", - "confirm": "Confirm" + "confirm": "Confirm", + "select": "Select", + "unselect": "Unselect", + "searching": "Searching" + }, + "paginator": { + "itemsPerPage": "Items per page", + "nextPage": "Next page", + "prevPage": "Previous page", + "firstPage": "First page", + "lastPage": "Last page" }, "timezone": { "Africa/Abidjan": "Africa/Abidjan", @@ -622,7 +644,17 @@ "name": "Group name", "nameFavorit": "Favorit", "nameMyDept": "My Dept", - "nameDefault": "Default" + "nameDefault": "Default", + "favorite": "Favorite", + "unfavorite": "Unfavorite", + "removeBuddyFromGroup": "Remove buddy from group", + "copyBuddyToGroup": "Copy buddy to other group", + "moveBuddyToGroup": "Move buddy to otyer group", + "changeGroupName": "Change name of group", + "modifyGroupMember": "Modify member of group", + "removeGroup": "Remove group", + "startChatWithGroup": "Chat with group", + "sendMessageToGroup": "Send message to group" }, "chat": { "label": "Chat", @@ -630,14 +662,40 @@ "searchRoomByName": "Search by room name", "newTimerChat": "New Timer Chat", "newChat": "New Chat", + "startChat": "Chat", "openRoom": "Open room", "turnOnRoomAlert": "turn on room alert", "turnOffRoomAlert": "turn off room alert", "leaveFromRoom": "leave room", - "confirmLeaveFromRoom": "Are you sure you want to leave the chat room?
Leave your chat history and chat room information." + "confirmLeaveFromRoom": "Do you want to leave the chat room?
Leave your chat history and chat room information.", + "confirmDeleteFile": "Do you want to delete the file?
The deleted file (message) will only be applied to your chat room and will not be deleted from their chat room.", + "typeReceived": "Received", + "typeSent": "Sent", + "sentDate": "Sent date", + "validityPeriod": "Validity period", + "forwardFileToMe": "Forward file to me", + "forwardFileTo": "Forward file to ..." }, "organization": { - "chart": "Organization chart" + "chart": "Organization chart", + "addToGroup": "Add to group", + "startChat": "Chat", + "startVideoConference": "Video conference", + "makeExtensionCall": "Make extension call", + "makeMobileCall": "Make mobile call", + "sendMessage": "Send message", + "sendSMS": "Send SMS" }, - "message": {} + "message": { + "label": "Message", + "sendTo": "Send message", + "placeholderForSearch": "search for name, title, content", + "messageTypeAll": "All", + "messageTypeReceiving": "Receiving", + "messageTypeOutgoing": "Outgoing", + "messageTypeReservation": "Reservation", + "searchTypeName": "Name", + "searchTypeTitle": "Title", + "searchTypeContent": "Content" + } } diff --git a/projects/ucap-webmessenger-app/src/assets/i18n/ko.json b/projects/ucap-webmessenger-app/src/assets/i18n/ko.json index f4d12e11..81c13f4f 100644 --- a/projects/ucap-webmessenger-app/src/assets/i18n/ko.json +++ b/projects/ucap-webmessenger-app/src/assets/i18n/ko.json @@ -6,14 +6,36 @@ "useOnlyForSpecialCharacter": "특수문자는 {{v}}만 사용할 수 있습니다.", "howManyPersons": "명", "file": { + "name": "파일 이름", + "size": "파일 크기", + "download": "파일 다운로드", + "delete": "파일 삭제", "saved": "파일이 저장되었습니다.", "savedToPath": "파일이 경로[{{v}}]에 저장되었습니다.", - "failToSave": "파일 저장에 실패하였습니다." + "failToSave": "파일 저장에 실패하였습니다.", + "downloadSelected": "선택된 파일 다운로드", + "openDownloadFolder": "다운로드 폴더 열기", + "selectFiles": "파일을 선택하세요", + "type": { + "label": "파일 종류", + "images": "이미지", + "video": "동영상" + } }, "messages": { "yes": "네", "no": "아니오", - "confirm": "확인" + "confirm": "확인", + "select": "선택", + "unselect": "선택 해제", + "searching": "검색중" + }, + "paginator": { + "itemsPerPage": "페이지별 갯수", + "nextPage": "다음 페이지", + "prevPage": "이전 페이지", + "firstPage": "처음 페이지", + "lastPage": "마지막 페이지" }, "timezone": { "Africa/Abidjan": "아프리카/아비 장", @@ -622,7 +644,17 @@ "name": "그룹 이름", "nameFavorit": "즐겨찾기", "nameMyDept": "소속부서", - "nameDefault": "기본" + "nameDefault": "기본", + "favorite": "즐겨찾기 등록", + "unfavorite": "즐겨찾기 해제", + "removeBuddyFromGroup": "이 그룹에서 삭제", + "copyBuddyToGroup": "대화 상대 복사", + "moveBuddyToGroup": "대화 상대 이동", + "changeGroupName": "그룹 이름 바꾸기", + "modifyGroupMember": "그룹 멤버 변경", + "removeGroup": "그룹 삭제", + "startChatWithGroup": "그룹 대화하기", + "sendMessageToGroup": "그룹 쪽지 보내기" }, "chat": { "label": "대화", @@ -630,14 +662,40 @@ "searchRoomByName": "대화방 이름 검색", "newTimerChat": "새로운 타이머 대화", "newChat": "새로운 대화", + "startChat": "대화하기", "openRoom": "대화방 열기", "turnOnRoomAlert": "대화방 알람 켜기", "turnOffRoomAlert": "대화방 알람 끄기", "leaveFromRoom": "대화방 나가기", - "confirmLeaveFromRoom": "대화방을 나가시겠습니까?
나가기를 하면 대화내용 및 대화방 정보가 삭제됩니다." + "confirmLeaveFromRoom": "대화방을 나가시겠습니까?
나가기를 하면 대화내용 및 대화방 정보가 삭제됩니다.", + "confirmDeleteFile": "선택한 파일(메시지)를 삭제하시겠습니까?
삭제된 파일(메시지)는 내 대화방에서만 적용되며 상대방의 대화방에서는 삭제되지 않습니다.", + "typeReceived": "수신", + "typeSent": "발신", + "sentDate": "보낸 날짜", + "validityPeriod": "유효 기간", + "forwardFileToMe": "파일을 나에게 전달", + "forwardFileTo": "파일 전달" }, "organization": { - "chart": "조직도" + "chart": "조직도", + "addToGroup": "그룹에 추가", + "startChat": "대화", + "startVideoConference": "화상회의", + "makeExtensionCall": "내선번호 전화걸기", + "makeMobileCall": "모바일 전화걸기", + "sendMessage": "쪽지 보내기", + "sendSMS": "SMS 보내기" }, - "message": {} + "message": { + "label": "쪽지", + "sendTo": "쪽지 보내기", + "placeholderForSearch": "이름, 제목, 내용 검색", + "messageTypeAll": "전체", + "messageTypeReceiving": "수신", + "messageTypeOutgoing": "발신", + "messageTypeReservation": "예약", + "searchTypeName": "이름", + "searchTypeTitle": "제목", + "searchTypeContent": "내용" + } } diff --git a/projects/ucap-webmessenger-ui/src/lib/services/paginator-intl.service.ts b/projects/ucap-webmessenger-ui/src/lib/services/paginator-intl.service.ts new file mode 100644 index 00000000..f9b2a672 --- /dev/null +++ b/projects/ucap-webmessenger-ui/src/lib/services/paginator-intl.service.ts @@ -0,0 +1,66 @@ +import { Injectable } from '@angular/core'; + +import { MatPaginatorIntl } from '@angular/material'; +import { TranslateService } from '@ngx-translate/core'; + +const KEY_ITEMS_PER_PAGE = 'common.paginator.itemsPerPage'; +const KEY_NEXT_PAGE = 'common.paginator.nextPage'; +const KEY_PREV_PAGE = 'common.paginator.prevPage'; +const KEY_FIRST_PAGE = 'common.paginator.firstPage'; +const KEY_LAST_PAGE = 'common.paginator.lastPage'; + +@Injectable({ + providedIn: 'root' +}) +export class PaginatorIntlService extends MatPaginatorIntl { + public constructor(private translateService: TranslateService) { + super(); + + this.translateService.onLangChange.subscribe((e: Event) => { + this.getAndInitTranslations(); + }); + + this.getAndInitTranslations(); + } + + public getRangeLabel = ( + page: number, + pageSize: number, + length: number + ): string => { + if (0 === length || 0 === pageSize) { + return `0 / ${length}`; + } + + length = Math.max(length, 0); + + const startIndex = page * pageSize; + const endIndex = + startIndex < length + ? Math.min(startIndex + pageSize, length) + : startIndex + pageSize; + + return `${startIndex + 1} - ${endIndex} / ${length}`; + // tslint:disable-next-line: semicolon + }; + + public getAndInitTranslations(): void { + this.translateService + .get([ + KEY_ITEMS_PER_PAGE, + KEY_NEXT_PAGE, + KEY_PREV_PAGE, + KEY_FIRST_PAGE, + KEY_LAST_PAGE + ]) + .subscribe((translation: any) => { + this.itemsPerPageLabel = translation[KEY_ITEMS_PER_PAGE]; + this.nextPageLabel = translation[KEY_NEXT_PAGE]; + this.previousPageLabel = translation[KEY_PREV_PAGE]; + this.firstPageLabel = translation[KEY_FIRST_PAGE]; + this.lastPageLabel = translation[KEY_LAST_PAGE]; + + this.changes.next(); + }); + } +} diff --git a/projects/ucap-webmessenger-ui/src/lib/ucap-ui.module.ts b/projects/ucap-webmessenger-ui/src/lib/ucap-ui.module.ts index bec44b55..51f20765 100644 --- a/projects/ucap-webmessenger-ui/src/lib/ucap-ui.module.ts +++ b/projects/ucap-webmessenger-ui/src/lib/ucap-ui.module.ts @@ -22,7 +22,7 @@ import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatTabsModule, MatSelectModule, - MatSlideToggleModule, + MatSlideToggleModule } from '@angular/material'; import { DragDropModule } from '@angular/cdk/drag-drop'; @@ -50,6 +50,7 @@ import { SnackBarService } from './services/snack-bar.service'; import { SplashScreenService } from './services/splash-screen.service'; import { TranslateService } from './services/translate.service'; import { DateService } from './services/date.service'; +import { PaginatorIntlService } from './services/paginator-intl.service'; import { ClickOutsideDirective } from './directives/click-outside.directive'; import { FileUploadForDirective } from './directives/file-upload-for.directive'; @@ -125,7 +126,8 @@ const SERVICES = [ SnackBarService, SplashScreenService, TranslateService, - DateService + DateService, + PaginatorIntlService ]; @NgModule({ diff --git a/projects/ucap-webmessenger-ui/src/public-api.ts b/projects/ucap-webmessenger-ui/src/public-api.ts index 0c69fba6..10741518 100644 --- a/projects/ucap-webmessenger-ui/src/public-api.ts +++ b/projects/ucap-webmessenger-ui/src/public-api.ts @@ -35,6 +35,7 @@ export * from './lib/services/snack-bar.service'; export * from './lib/services/splash-screen.service'; export * from './lib/services/translate.service'; export * from './lib/services/date.service'; +export * from './lib/services/paginator-intl.service'; export * from './lib/types/file-viewer.type';