i18n is working

This commit is contained in:
Richard Park 2020-01-06 18:05:34 +09:00
parent 1d7cfbb9e5
commit 4293c8b16c
11 changed files with 300 additions and 224 deletions

View File

@ -100,7 +100,7 @@ export class FileViewerDialogComponent implements OnInit, OnDestroy {
if (!!result) {
this.translateService
.get('common.file.savedToPath', {
v: result
path: result
})
.pipe(take(1))
.subscribe(v => {

View File

@ -32,7 +32,9 @@
class="icon-item"
[matBadgeHidden]="badgeChatUnReadCount <= 0"
[matBadge]="badgeChatUnReadCount"
matBadgeDescription="확인하지 않은 메시지가 있습니다."
matBadgeDescription="{{
'chat.badgeDescriptionForUnread' | translate
}}"
matBadgeColor="accent"
matBadgePosition="above after"
matTooltip="Chat"
@ -93,7 +95,9 @@
class="icon-item"
[matBadgeHidden]="(badgeMessageUnReadCount$ | async) <= 0"
[matBadge]="badgeMessageUnReadCount$ | async"
matBadgeDescription="확인하지 않은 메시지가 있습니다."
matBadgeDescription="{{
'message.badgeDescriptionForUnread' | translate
}}"
matBadgeColor="accent"
matBadgePosition="above after"
matTooltip="Message"

View File

@ -36,7 +36,7 @@ import { OpenProfileOptions } from '@ucap-webmessenger/protocol-buddy';
import { SessionStorageService } from '@ucap-webmessenger/web-storage';
import { VersionInfo2Response } from '@ucap-webmessenger/api-public';
import { MessageType } from '@ucap-webmessenger/api-message';
import { tap } from 'rxjs/operators';
import { tap, take } from 'rxjs/operators';
import {
MessageWriteDialogComponent,
MessageWriteDialogResult,
@ -49,6 +49,7 @@ import {
} from '@app/types';
import { MessageBoxComponent } from './left-sidenav/message.component';
import { environment } from '../../../../environments/environment';
import { TranslateService } from '@ngx-translate/core';
export enum MainMenu {
Group = 'GROUP',
@ -105,6 +106,7 @@ export class LeftSideComponent implements OnInit, OnDestroy {
private store: Store<any>,
private dialogService: DialogService,
private sessionStorageService: SessionStorageService,
private translateService: TranslateService,
private logger: NGXLogger
) {
this.sessionVerinfo = this.sessionStorageService.get<VersionInfo2Response>(
@ -164,65 +166,78 @@ export class LeftSideComponent implements OnInit, OnDestroy {
this.logger.debug('-----------------------LeftSideComponent ngOnDestroy');
}
async onClickNewChat(type: string = 'NORMAL') {
const result = await this.dialogService.open<
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
>(CreateChatDialogComponent, {
width: '600px',
data: {
type: UserSelectDialogType.NewChat,
title: type === 'TIMER' ? 'chat.newTimerChat' : 'chat.newChat'
}
});
onClickNewChat(type: string = 'NORMAL') {
this.translateService
.get(['chat.newTimerChat', 'chat.newChat'])
.pipe(take(1))
.subscribe(async vs => {
const result = await this.dialogService.open<
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
>(CreateChatDialogComponent, {
width: '600px',
data: {
type: UserSelectDialogType.NewChat,
title:
type === 'TIMER' ? vs['chat.newTimerChat'] : vs['chat.newChat']
}
});
if (!!result && !!result.choice && result.choice) {
if (!!result.selectedUserList && result.selectedUserList.length > 0) {
const userSeqs: number[] = [];
result.selectedUserList.map(user => userSeqs.push(user.seq));
if (!!result && !!result.choice && result.choice) {
if (!!result.selectedUserList && result.selectedUserList.length > 0) {
const userSeqs: number[] = [];
result.selectedUserList.map(user => userSeqs.push(user.seq));
if (type === 'NORMAL') {
this.store.dispatch(ChatStore.openRoom({ userSeqList: userSeqs }));
} else if (type === 'TIMER') {
this.store.dispatch(
ChatStore.openRoom({ userSeqList: userSeqs, isTimeRoom: true })
);
if (type === 'NORMAL') {
this.store.dispatch(
ChatStore.openRoom({ userSeqList: userSeqs })
);
} else if (type === 'TIMER') {
this.store.dispatch(
ChatStore.openRoom({ userSeqList: userSeqs, isTimeRoom: true })
);
}
}
}
}
}
});
}
async onClickNewGroupAndMember() {
const result = await this.dialogService.open<
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
>(CreateChatDialogComponent, {
width: '600px',
data: {
type: UserSelectDialogType.NewGroup,
title: 'group.addNew'
}
});
onClickNewGroupAndMember() {
this.translateService
.get(['group.addNew'])
.pipe(take(1))
.subscribe(async vs => {
const result = await this.dialogService.open<
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
>(CreateChatDialogComponent, {
width: '600px',
data: {
type: UserSelectDialogType.NewGroup,
title: vs['group.addNew']
}
});
if (!!result && !!result.choice && result.choice) {
if (
!!result.selectedUserList &&
// result.selectedUserList.length > 0 &&
result.groupName.trim().length > 0
) {
const userSeqs: number[] = [];
result.selectedUserList.map(user => userSeqs.push(user.seq));
if (!!result && !!result.choice && result.choice) {
if (
!!result.selectedUserList &&
// result.selectedUserList.length > 0 &&
result.groupName.trim().length > 0
) {
const userSeqs: number[] = [];
result.selectedUserList.map(user => userSeqs.push(user.seq));
this.store.dispatch(
SyncStore.createGroupAndBuddy({
groupName: result.groupName,
trgtUserSeq: userSeqs
})
);
}
}
this.store.dispatch(
SyncStore.createGroupAndBuddy({
groupName: result.groupName,
trgtUserSeq: userSeqs
})
);
}
}
});
}
async onClickNewMessage() {
@ -289,67 +304,78 @@ export class LeftSideComponent implements OnInit, OnDestroy {
}
});
}
setFabInitial(type: string) {
switch (type) {
case MainMenu.Group:
{
this.fabButtonShow = true;
this.fabButtons = [
{
icon: 'add',
tooltip: 'New Group Add',
divisionType: 'GROUP_NEW_ADD'
}
];
}
break;
case MainMenu.Chat:
{
this.fabButtonShow = true;
this.fabButtons = [
{
icon: 'chat',
tooltip: 'New Chat',
divisionType: 'CAHT_NEW_ADD'
}
];
if (environment.productConfig.CommonSetting.useTimerRoom) {
this.fabButtons.push({
icon: 'timer',
tooltip: 'New Timer Chat',
divisionType: 'CHAT_NEW_TIMER_ADD'
});
setFabInitial(type: string) {
this.translateService
.get([
'group.addNew',
'chat.newChat',
'chat.newTimerChat',
'message.newMessage'
])
.pipe(take(1))
.subscribe(async vs => {
switch (type) {
case MainMenu.Group:
{
this.fabButtonShow = true;
this.fabButtons = [
{
icon: 'add',
tooltip: vs['group.addNew'],
divisionType: 'GROUP_NEW_ADD'
}
];
}
break;
case MainMenu.Chat:
{
this.fabButtonShow = true;
this.fabButtons = [
{
icon: 'chat',
tooltip: vs['chat.newChat'],
divisionType: 'CAHT_NEW_ADD'
}
];
if (environment.productConfig.CommonSetting.useTimerRoom) {
this.fabButtons.push({
icon: 'timer',
tooltip: vs['chat.newTimerChat'],
divisionType: 'CHAT_NEW_TIMER_ADD'
});
}
}
break;
case MainMenu.Organization:
{
this.fabButtonShow = false;
}
break;
case MainMenu.Message:
{
this.fabButtonShow = true;
this.fabButtons = [
{
icon: 'add',
tooltip: vs['message.newMessage'],
divisionType: 'MESSAGE_NEW'
}
];
}
break;
case MainMenu.Call:
{
this.fabButtonShow = false;
}
break;
default: {
this.fabButtonShow = false;
}
}
break;
case MainMenu.Organization:
{
this.fabButtonShow = false;
}
break;
case MainMenu.Message:
{
this.fabButtonShow = true;
this.fabButtons = [
{
icon: 'add',
tooltip: 'New Message',
divisionType: 'MESSAGE_NEW'
}
];
}
break;
case MainMenu.Call:
{
this.fabButtonShow = false;
}
break;
default: {
this.fabButtonShow = false;
}
}
});
}
onCheckAllUser(params: {

View File

@ -234,7 +234,7 @@ export class AlbumBoxComponent implements OnInit, OnDestroy {
if (!!result) {
this.translateService
.get('common.file.savedToPath', {
v: result
path: result
})
.pipe(take(1))
.subscribe(v => {

View File

@ -278,7 +278,7 @@ export class FileBoxComponent implements OnInit, OnDestroy {
if (!!result) {
this.translateService
.get('common.file.savedToPath', {
v: result
path: result
})
.pipe(take(1))
.subscribe(v => {

View File

@ -12,7 +12,7 @@
<table mat-table [dataSource]="noticelist">
<ng-container matColumnDef="title">
<th mat-header-cell *matHeaderCellDef class="infos">
제목
{{ 'notice.fieldTitle' | translate }}
</th>
<td mat-cell *matCellDef="let element" class="notice-info">
<div class="title">
@ -23,7 +23,7 @@
</ng-container>
<ng-container matColumnDef="regDate">
<th mat-header-cell *matHeaderCellDef>
게시일
{{ 'notice.fieldPostDate' | translate }}
</th>
<td mat-cell *matCellDef="let element" class="date">
<div class="date">

View File

@ -17,10 +17,10 @@
class="btn-box"
>
<button mat-flat-button class="mat-primary" (click)="onClickAddMember()">
대화상대추가
{{ 'chat.addMemberToRoom' | translate }}
</button>
<button mat-flat-button class="mat-primary" (click)="onClickAddGroup()">
그룹멤버로추가
{{ 'chat.addMemberToGroup' | translate }}
</button>
</div>
</div>
@ -39,7 +39,7 @@
>
<ng-template matMenuContent let-buddy="buddy">
<button mat-menu-item (click)="onClickContextMenu('FORCING_EXIT', buddy)">
대화방 퇴장
{{ 'chat.ejectFromRoom' | translate }}
</button>
</ng-template>
</mat-menu>

View File

@ -8,7 +8,7 @@ import {
} from '@angular/core';
import { Subscription } from 'rxjs';
import { Store, select } from '@ngrx/store';
import { tap, map } from 'rxjs/operators';
import { tap, map, take } from 'rxjs/operators';
import * as AppStore from '@app/store';
import * as SyncStore from '@app/store/messenger/sync';
@ -41,6 +41,7 @@ import {
} from '@app/types';
import { LoginResponse } from '@ucap-webmessenger/protocol-authentication';
import { MatMenuTrigger, MatDialog } from '@angular/material';
import { TranslateService } from '@ngx-translate/core';
@Component({
selector: 'app-layout-chat-right-drawer-room-user-list',
@ -67,6 +68,7 @@ export class RoomUserListComponent implements OnInit, OnDestroy {
constructor(
private store: Store<any>,
private sessionStorageService: SessionStorageService,
private translateService: TranslateService,
private dialogService: DialogService,
private dialogRef: MatDialog
) {
@ -135,83 +137,93 @@ export class RoomUserListComponent implements OnInit, OnDestroy {
this.openProfile.emit(userSeq);
}
async onClickAddMember() {
const result = await this.dialogService.open<
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
>(CreateChatDialogComponent, {
width: '600px',
data: {
type: UserSelectDialogType.EditChatMember,
title: 'Edit Chat Member',
curRoomUser: this.userInfoList.filter(
user => user.seq !== this.loginRes.userSeq && user.isJoinRoom
)
}
});
if (!!result && !!result.choice && result.choice) {
const userSeqs: number[] = this.userInfoList.map(userInfo => {
if (userInfo.isJoinRoom) {
return userInfo.seq;
}
});
if (!!result.selectedUserList && result.selectedUserList.length > 0) {
result.selectedUserList.forEach(user => {
if (userSeqs.indexOf(user.seq) < 0) {
userSeqs.push(user.seq);
onClickAddMember() {
this.translateService
.get('chat.modifyRoomMember')
.pipe(take(1))
.subscribe(async v => {
const result = await this.dialogService.open<
CreateChatDialogComponent,
CreateChatDialogData,
CreateChatDialogResult
>(CreateChatDialogComponent, {
width: '600px',
data: {
type: UserSelectDialogType.EditChatMember,
title: v,
curRoomUser: this.userInfoList.filter(
user => user.seq !== this.loginRes.userSeq && user.isJoinRoom
)
}
});
}
if (userSeqs.length > 0) {
// include me
userSeqs.push(this.loginRes.userSeq);
this.store.dispatch(
RoomStore.inviteOrOpen({
req: {
divCd: 'Invite',
userSeqs
if (!!result && !!result.choice && result.choice) {
const userSeqs: number[] = this.userInfoList.map(userInfo => {
if (userInfo.isJoinRoom) {
return userInfo.seq;
}
})
);
}
}
});
if (!!result.selectedUserList && result.selectedUserList.length > 0) {
result.selectedUserList.forEach(user => {
if (userSeqs.indexOf(user.seq) < 0) {
userSeqs.push(user.seq);
}
});
}
if (userSeqs.length > 0) {
// include me
userSeqs.push(this.loginRes.userSeq);
this.store.dispatch(
RoomStore.inviteOrOpen({
req: {
divCd: 'Invite',
userSeqs
}
})
);
}
}
});
}
async onClickAddGroup() {
const result = await this.dialogService.open<
SelectGroupDialogComponent,
SelectGroupDialogData,
SelectGroupDialogResult
>(SelectGroupDialogComponent, {
width: '600px',
data: {
title: 'Group Select'
}
});
onClickAddGroup() {
this.translateService
.get('group.selectTargetGroup')
.pipe(take(1))
.subscribe(async v => {
const result = await this.dialogService.open<
SelectGroupDialogComponent,
SelectGroupDialogData,
SelectGroupDialogResult
>(SelectGroupDialogComponent, {
width: '600px',
data: {
title: v
}
});
if (!!result && !!result.choice && result.choice) {
if (!!result.group) {
const oldGroup: GroupDetailData = result.group;
const trgtUserSeq: number[] = [];
result.group.userSeqs.map(seq => trgtUserSeq.push(seq));
this.userInfoList
.filter(v => result.group.userSeqs.indexOf(v.seq) < 0)
.forEach(user => {
trgtUserSeq.push(user.seq);
});
if (!!result && !!result.choice && result.choice) {
if (!!result.group) {
const oldGroup: GroupDetailData = result.group;
const trgtUserSeq: number[] = [];
result.group.userSeqs.map(seq => trgtUserSeq.push(seq));
this.userInfoList
.filter(v => result.group.userSeqs.indexOf(v.seq) < 0)
.forEach(user => {
trgtUserSeq.push(user.seq);
});
this.store.dispatch(
SyncStore.updateGroupMember({
oldGroup,
trgtUserSeq
})
);
}
}
this.store.dispatch(
SyncStore.updateGroupMember({
oldGroup,
trgtUserSeq
})
);
}
}
});
}
onContextMenuRoomUser(event: MouseEvent, buddy: UserInfo) {
@ -229,33 +241,40 @@ export class RoomUserListComponent implements OnInit, OnDestroy {
this.roomUserContextMenuTrigger.openMenu();
}
async onClickContextMenu(type: string, buddy: UserInfo) {
onClickContextMenu(type: string, buddy: UserInfo) {
switch (type) {
case 'FORCING_EXIT':
{
const result = await this.dialogService.open<
ConfirmDialogComponent,
ConfirmDialogData,
ConfirmDialogResult
>(ConfirmDialogComponent, {
data: {
title: '강제 퇴장',
html: `${buddy.name} 님을 대화방에서 퇴장 시키겠습니까?`
}
});
if (!!result && !!result.choice && result.choice) {
this.store.dispatch(
RoomStore.exitForcing({
req: {
roomSeq: this.roomInfo.roomSeq,
senderSeq: this.loginRes.userSeq,
type: 'A',
userSeqs: [buddy.seq]
this.translateService
.get(['chat.ejectFromRoom', 'chat.confirmEjectFromRoom'], {
targetMember: buddy.name
})
.pipe(take(1))
.subscribe(async vs => {
const result = await this.dialogService.open<
ConfirmDialogComponent,
ConfirmDialogData,
ConfirmDialogResult
>(ConfirmDialogComponent, {
data: {
title: vs['chat.ejectFromRoom'],
html: vs['chat.confirmEjectFromRoom']
}
})
);
}
});
if (!!result && !!result.choice && result.choice) {
this.store.dispatch(
RoomStore.exitForcing({
req: {
roomSeq: this.roomInfo.roomSeq,
senderSeq: this.loginRes.userSeq,
type: 'A',
userSeqs: [buddy.seq]
}
})
);
}
});
}
break;
}

View File

@ -1,13 +1,14 @@
<mat-card class="confirm-card mat-elevation-z">
<mat-card-header cdkDrag cdkDragRootElement=".cdk-overlay-pane" cdkDragHandle>
<mat-card-title>{{ data.title | translate }}</mat-card-title>
<mat-card-title>{{ data.title }}</mat-card-title>
</mat-card-header>
<mat-card-content>
<div *ngIf="data.type === UserSelectDialogType.NewGroup">
<form name="inputForm" [formGroup]="inputForm" novalidate>
<mat-form-field
hintLabel="{{
'common.useOnlyForSpecialCharacter' | translate: { v: '-,_' }
'common.useOnlyForSpecialCharacter'
| translate: { specialCharacter: '-,_' }
}}"
style="display:block;margin-bottom:10px;"
>

View File

@ -654,7 +654,8 @@
"modifyGroupMember": "Modify member of group",
"removeGroup": "Remove group",
"startChatWithGroup": "Chat with group",
"sendMessageToGroup": "Send message to group"
"sendMessageToGroup": "Send message to group",
"selectTargetGroup": "Select target group"
},
"chat": {
"label": "Chat",
@ -674,7 +675,13 @@
"sentDate": "Sent date",
"validityPeriod": "Validity period",
"forwardFileToMe": "Forward file to me",
"forwardFileTo": "Forward file to ..."
"forwardFileTo": "Forward file to ...",
"addMemberToRoom": "Add member to room",
"addMemberToGroup": "Add member to group",
"modifyRoomMember": "Modify chat room member",
"ejectFromRoom": "Eject from room",
"confirmEjectFromRoom": "Do you want to eject member[{{targetMember}}] from room?",
"badgeDescriptionForUnread": "There is an unconfirmed message."
},
"organization": {
"chart": "Organization chart",
@ -688,6 +695,7 @@
},
"message": {
"label": "Message",
"newMessage": "New message",
"sendTo": "Send message",
"placeholderForSearch": "search for name, title, content",
"messageTypeAll": "All",
@ -696,6 +704,11 @@
"messageTypeReservation": "Reservation",
"searchTypeName": "Name",
"searchTypeTitle": "Title",
"searchTypeContent": "Content"
"searchTypeContent": "Content",
"badgeDescriptionForUnread": "There is an unconfirmed message."
},
"notice": {
"fieldTitle": "Title",
"fieldPostDate": "Post date"
}
}

View File

@ -3,7 +3,7 @@
"search": "검색",
"searchWord": "검색어",
"searchResult": "검색 결과",
"useOnlyForSpecialCharacter": "특수문자는 {{v}}만 사용할 수 있습니다.",
"useOnlyForSpecialCharacter": "특수문자는 {{specialCharacter}}만 사용할 수 있습니다.",
"howManyPersons": "명",
"file": {
"name": "파일 이름",
@ -11,7 +11,7 @@
"download": "파일 다운로드",
"delete": "파일 삭제",
"saved": "파일이 저장되었습니다.",
"savedToPath": "파일이 경로[{{v}}]에 저장되었습니다.",
"savedToPath": "파일이 경로[{{path}}]에 저장되었습니다.",
"failToSave": "파일 저장에 실패하였습니다.",
"downloadSelected": "선택된 파일 다운로드",
"openDownloadFolder": "다운로드 폴더 열기",
@ -654,7 +654,8 @@
"modifyGroupMember": "그룹 멤버 변경",
"removeGroup": "그룹 삭제",
"startChatWithGroup": "그룹 대화하기",
"sendMessageToGroup": "그룹 쪽지 보내기"
"sendMessageToGroup": "그룹 쪽지 보내기",
"selectTargetGroup": "대상 그룹 선택"
},
"chat": {
"label": "대화",
@ -674,7 +675,13 @@
"sentDate": "보낸 날짜",
"validityPeriod": "유효 기간",
"forwardFileToMe": "파일을 나에게 전달",
"forwardFileTo": "파일 전달"
"forwardFileTo": "파일 전달",
"addMemberToRoom": "대화 상대 추가",
"addMemberToGroup": "그룹 멤버로 추가",
"modifyRoomMember": "대화방 멤버 편집",
"ejectFromRoom": "Eject from room",
"confirmEjectFromRoom": "{{targetMember}} 님을 대화방에서 퇴장 시키겠습니까?",
"badgeDescriptionForUnread": "확인하지 않은 메시지가 있습니다."
},
"organization": {
"chart": "조직도",
@ -688,6 +695,7 @@
},
"message": {
"label": "쪽지",
"newMessage": "새로운 쪽지",
"sendTo": "쪽지 보내기",
"placeholderForSearch": "이름, 제목, 내용 검색",
"messageTypeAll": "전체",
@ -696,6 +704,11 @@
"messageTypeReservation": "예약",
"searchTypeName": "이름",
"searchTypeTitle": "제목",
"searchTypeContent": "내용"
"searchTypeContent": "내용",
"badgeDescriptionForUnread": "확인하지 않은 쪽지가 있습니다."
},
"notice": {
"fieldTitle": "제목",
"fieldPostDate": "게시일"
}
}