Archived
2
0

i18n (wip)

This commit is contained in:
Craig
2020-04-05 02:57:22 +00:00
parent bf51a3ff3a
commit 75f54db90e
15 changed files with 178 additions and 57 deletions

View File

@ -54,9 +54,9 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.disconnect()
this.cleanup()
this.$vue.$swal({
title: 'You have logged out!',
title: this.$vue.$t('notifications.logged_out', { name: 'You' }),
icon: 'info',
confirmButtonText: 'ok',
confirmButtonText: this.$vue.$t('ok') as string,
})
}
@ -75,7 +75,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$vue.$notify({
group: 'neko',
type: 'success',
title: 'Successfully connected',
title: this.$vue.$t('connection.success') as string,
duration: 5000,
speed: 1000,
})
@ -86,7 +86,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$vue.$notify({
group: 'neko',
type: 'error',
title: `Disconnected:`,
title: this.$vue.$t('disconnected') as string,
text: reason ? reason.message : undefined,
duration: 5000,
speed: 1000,
@ -111,10 +111,10 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
protected [EVENT.SYSTEM.DISCONNECT]({ message }: DisconnectPayload) {
this.onDisconnected(new Error(message))
this.$vue.$swal({
title: 'Disconnected!',
title: this.$vue.$t('disconnected'),
text: message,
icon: 'error',
confirmButtonText: 'ok',
confirmButtonText: this.$vue.$t('ok') as string,
})
}
@ -125,7 +125,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.user.setMembers(members)
this.$accessor.chat.newMessage({
id: this.id,
content: 'connected',
content: this.$vue.$t('connected') as string,
type: 'event',
created: new Date(),
})
@ -137,7 +137,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
if (member.id !== this.id) {
this.$accessor.chat.newMessage({
id: member.id,
content: 'connected',
content: this.$vue.$t('connected') as string,
type: 'event',
created: new Date(),
})
@ -152,7 +152,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({
id: member.id,
content: 'disconnected',
content: this.$vue.$t('disconnected') as string,
type: 'event',
created: new Date(),
})
@ -174,7 +174,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$vue.$notify({
group: 'neko',
type: 'info',
title: `You have the controls`,
title: this.$vue.$t('notifications.controls_taken', { name: this.$vue.$t('you') }) as string,
duration: 5000,
speed: 1000,
})
@ -182,7 +182,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({
id: member.id,
content: 'took the controls',
content: this.$vue.$t('notifications.controls_taken', { name: '' }) as string,
type: 'event',
created: new Date(),
})
@ -199,7 +199,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$vue.$notify({
group: 'neko',
type: 'info',
title: `You released the controls`,
title: this.$vue.$t('notifications.controls_released', { name: this.$vue.$t('you') }) as string,
duration: 5000,
speed: 1000,
})
@ -207,7 +207,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({
id: member.id,
content: 'released the controls',
content: this.$vue.$t('notifications.controls_released') as string,
type: 'event',
created: new Date(),
})
@ -222,8 +222,8 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$vue.$notify({
group: 'neko',
type: 'info',
title: `${member.displayname} has the controls`,
text: 'But I let them know you wanted it',
title: this.$vue.$t('notifications.controls_has', { name: member.displayname }) as string,
text: this.$vue.$t('notifications.controls_has_alt') as string,
duration: 5000,
speed: 1000,
})
@ -238,7 +238,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$vue.$notify({
group: 'neko',
type: 'info',
title: `${member.displayname} is requesting the controls`,
title: this.$vue.$t('notifications.controls_requesting', { name: member.displayname }) as string,
duration: 5000,
speed: 1000,
})
@ -253,7 +253,9 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.remote.setHost(member)
this.$accessor.chat.newMessage({
id,
content: `gave the controls to ${member.id == this.id ? 'you' : member.displayname}`,
content: this.$vue.$t('notifications.controls_given', {
name: member.id == this.id ? this.$vue.$t('you') : member.displayname,
}) as string,
type: 'event',
created: new Date(),
})
@ -310,7 +312,11 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({
id,
content: `changed the resolution to ${width}x${height}@${rate}`,
content: this.$vue.$t('notifications.resolution', {
width: width,
height: height,
rate: rate,
}) as string,
type: 'event',
created: new Date(),
})
@ -331,7 +337,9 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({
id,
content: `banned ${member.id == this.id ? 'you' : member.displayname}`,
content: this.$vue.$t('notifications.banned', {
name: member.id == this.id ? this.$vue.$t('you') : member.displayname,
}) as string,
type: 'event',
created: new Date(),
})
@ -349,7 +357,9 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({
id,
content: `kicked ${member.id == this.id ? 'you' : member.displayname}`,
content: this.$vue.$t('notifications.kicked', {
name: member.id == this.id ? this.$vue.$t('you') : member.displayname,
}) as string,
type: 'event',
created: new Date(),
})
@ -369,7 +379,9 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({
id,
content: `muted ${member.id == this.id ? 'you' : member.displayname}`,
content: this.$vue.$t('notifications.muted', {
name: member.id == this.id ? this.$vue.$t('you') : member.displayname,
}) as string,
type: 'event',
created: new Date(),
})
@ -389,7 +401,9 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({
id,
content: `unmuted ${member.displayname}`,
content: this.$vue.$t('notifications.unmuted', {
name: member.id == this.id ? this.$vue.$t('you') : member.displayname,
}) as string,
type: 'event',
created: new Date(),
})
@ -399,7 +413,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.setLocked(true)
this.$accessor.chat.newMessage({
id,
content: `locked the room`,
content: this.$vue.$t('notifications.room_locked') as string,
type: 'event',
created: new Date(),
})
@ -409,7 +423,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.setLocked(false)
this.$accessor.chat.newMessage({
id,
content: `unlocked the room`,
content: this.$vue.$t('notifications.room_unlocked') as string,
type: 'event',
created: new Date(),
})
@ -421,7 +435,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
if (!target) {
this.$accessor.chat.newMessage({
id,
content: `force took the controls`,
content: this.$vue.$t('notifications.controls_taken_force') as string,
type: 'event',
created: new Date(),
})
@ -435,7 +449,9 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({
id,
content: `took the controls from ${member.id == this.id ? 'you' : member.displayname}`,
content: this.$vue.$t('notifications.controls_taken_steal', {
name: member.id == this.id ? this.$vue.$t('you') : member.displayname,
}) as string,
type: 'event',
created: new Date(),
})
@ -446,7 +462,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
if (!target) {
this.$accessor.chat.newMessage({
id,
content: `force released the controls`,
content: this.$vue.$t('notifications.controls_released_force') as string,
type: 'event',
created: new Date(),
})
@ -460,7 +476,9 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({
id,
content: `released the controls from ${member.id == this.id ? 'you' : member.displayname}`,
content: this.$vue.$t('notifications.controls_released_steal', {
name: member.id == this.id ? this.$vue.$t('you') : member.displayname,
}) as string,
type: 'event',
created: new Date(),
})
@ -480,7 +498,9 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({
id,
content: `gave the controls to ${member.id == this.id ? 'you' : member.displayname}`,
content: this.$vue.$t('notifications.controls_given', {
name: member.id == this.id ? this.$vue.$t('you') : member.displayname,
}) as string,
type: 'event',
created: new Date(),
})