Merge pull request #66 from m1k1o/locales

Improved i18n
This commit is contained in:
Nurdism 2020-04-06 13:44:02 -04:00 committed by GitHub
commit 0870a51223
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 32 deletions

View File

@ -35,7 +35,7 @@
<div v-if="!muted" class="chat-send"> <div v-if="!muted" class="chat-send">
<div class="accent" /> <div class="accent" />
<div class="text-container"> <div class="text-container">
<textarea ref="input" placeholder="Send a message" @keydown="onKeyDown" v-model="content" /> <textarea ref="input" :placeholder="$t('send_a_message')" @keydown="onKeyDown" v-model="content" />
<neko-emoji v-if="emoji" @picked="onEmojiPicked" @done="emoji = false" /> <neko-emoji v-if="emoji" @picked="onEmojiPicked" @done="emoji = false" />
<i class="emoji-menu fas fa-laugh" @click.stop.prevent="onEmoji"></i> <i class="emoji-menu fas fa-laugh" @click.stop.prevent="onEmoji"></i>
</div> </div>

View File

@ -165,11 +165,12 @@
kick(member: Member) { kick(member: Member) {
this.$swal({ this.$swal({
title: `Kick ${member.displayname}?`, title: this.$t('context.confirm.kick_title', { name: member.displayname }) as string,
text: `Are you sure you want to kick ${member.displayname}?`, text: this.$t('context.confirm.kick_text', { name: member.displayname }) as string,
icon: 'warning', icon: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Yes', confirmButtonText: this.$t('context.confirm.button_yes') as string,
cancelButtonText: this.$t('context.confirm.button_cancel') as string,
}).then(({ value }) => { }).then(({ value }) => {
if (value) { if (value) {
this.$accessor.user.kick(member) this.$accessor.user.kick(member)
@ -179,11 +180,12 @@
ban(member: Member) { ban(member: Member) {
this.$swal({ this.$swal({
title: `Ban ${member.displayname}?`, title: this.$t('context.confirm.ban_title', { name: member.displayname }) as string,
text: `Are you sure you want to ban ${member.displayname}? You will need to restart the server to undo this.`, text: this.$t('context.confirm.ban_text', { name: member.displayname }) as string,
icon: 'warning', icon: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Yes', confirmButtonText: this.$t('context.confirm.button_yes') as string,
cancelButtonText: this.$t('context.confirm.button_cancel') as string,
}).then(({ value }) => { }).then(({ value }) => {
if (value) { if (value) {
this.$accessor.user.ban(member) this.$accessor.user.ban(member)
@ -193,11 +195,12 @@
mute(member: Member) { mute(member: Member) {
this.$swal({ this.$swal({
title: `Mute ${member.displayname}?`, title: this.$t('context.confirm.mute_title', { name: member.displayname }) as string,
text: `Are you sure you want to mute ${member.displayname}?`, text: this.$t('context.confirm.mute_text', { name: member.displayname }) as string,
icon: 'warning', icon: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Yes', confirmButtonText: this.$t('context.confirm.button_yes') as string,
cancelButtonText: this.$t('context.confirm.button_cancel') as string,
}).then(({ value }) => { }).then(({ value }) => {
if (value) { if (value) {
this.$accessor.user.mute(member) this.$accessor.user.mute(member)
@ -207,11 +210,12 @@
unmute(member: Member) { unmute(member: Member) {
this.$swal({ this.$swal({
title: `Unmute ${member.displayname}?`, title: this.$t('context.confirm.unmute_title', { name: member.displayname }) as string,
text: `Are you sure you want to unmute ${member.displayname}?`, text: this.$t('context.confirm.unmute_text', { name: member.displayname }) as string,
icon: 'warning', icon: 'warning',
showCancelButton: true, showCancelButton: true,
confirmButtonText: 'Yes', confirmButtonText: this.$t('context.confirm.button_yes') as string,
cancelButtonText: this.$t('context.confirm.button_cancel') as string,
}).then(({ value }) => { }).then(({ value }) => {
if (value) { if (value) {
this.$accessor.user.unmute(member) this.$accessor.user.unmute(member)

View File

@ -4,11 +4,11 @@
<ul> <ul>
<li :class="{ active: tab === 'chat' }" @click.stop.prevent="change('chat')"> <li :class="{ active: tab === 'chat' }" @click.stop.prevent="change('chat')">
<i class="fas fa-comment-alt" /> <i class="fas fa-comment-alt" />
<span>{{ $t('chat') }}</span> <span>{{ $t('side.chat') }}</span>
</li> </li>
<li :class="{ active: tab === 'settings' }" @click.stop.prevent="change('settings')"> <li :class="{ active: tab === 'settings' }" @click.stop.prevent="change('settings')">
<i class="fas fa-sliders-h" /> <i class="fas fa-sliders-h" />
<span>{{ $t('settings') }}</span> <span>{{ $t('side.settings') }}</span>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -1,12 +1,13 @@
export const chat = 'Chat'
export const settings = 'Settings'
export const logout = 'logout' export const logout = 'logout'
export const unsupported = 'this browser does not support webrtc' export const unsupported = 'this browser does not support webrtc'
export const admin_loggedin = 'You are logged in as an admin' export const admin_loggedin = 'You are logged in as an admin'
export const you = 'You' export const you = 'You'
export const ok = 'ok' export const send_a_message = 'Send a message'
export const connected = 'connected'
export const disconnected = 'disconnected' export const side = {
chat: 'Chat',
settings: 'Settings',
}
export const connect = { export const connect = {
title: 'Please Login', title: 'Please Login',
@ -25,6 +26,18 @@ export const context = {
give: 'Give Controls', give: 'Give Controls',
kick: 'Kick', kick: 'Kick',
ban: 'Ban IP', ban: 'Ban IP',
confirm: {
kick_title: 'Kick {name}?',
kick_text: 'Are you sure you want to kick {name}?',
ban_title: 'Ban {name}?',
ban_text: 'Are you sure you want to ban {name}? You will need to restart the server to undo this.',
mute_title: 'Mute {name}?',
mute_text: 'Are you sure you want to mute {name}?',
unmute_title: 'Unmute {name}?',
unmute_text: 'Are you sure you want to unmute {name}?',
button_yes: 'Yes',
button_cancel: 'Cancel',
},
} }
export const controls = { export const controls = {
@ -50,11 +63,15 @@ export const setting = {
} }
export const connection = { export const connection = {
success: 'Successfully connected', logged_out: 'You have been logged out!',
connected: 'Successfully connected',
disconnected: 'You have been disconnected',
button_confirm: 'Ok',
} }
export const notifications = { export const notifications = {
logged_out: '{name} logged out!', connected: '{name} connected',
disconnected: '{name} disconnected',
controls_taken: '{name} took the controls', controls_taken: '{name} took the controls',
controls_taken_force: 'force took the controls', controls_taken_force: 'force took the controls',
controls_taken_steal: 'took the controls from {name}', controls_taken_steal: 'took the controls from {name}',

View File

@ -54,9 +54,9 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.disconnect() this.disconnect()
this.cleanup() this.cleanup()
this.$vue.$swal({ this.$vue.$swal({
title: this.$vue.$t('notifications.logged_out', { name: 'You' }), title: this.$vue.$t('connection.logged_out'),
icon: 'info', icon: 'info',
confirmButtonText: this.$vue.$t('ok') as string, confirmButtonText: this.$vue.$t('connection.button_confirm') as string,
}) })
} }
@ -75,7 +75,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$vue.$notify({ this.$vue.$notify({
group: 'neko', group: 'neko',
type: 'success', type: 'success',
title: this.$vue.$t('connection.success') as string, title: this.$vue.$t('connection.connected') as string,
duration: 5000, duration: 5000,
speed: 1000, speed: 1000,
}) })
@ -86,7 +86,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$vue.$notify({ this.$vue.$notify({
group: 'neko', group: 'neko',
type: 'error', type: 'error',
title: this.$vue.$t('disconnected') as string, title: this.$vue.$t('connection.disconnected') as string,
text: reason ? reason.message : undefined, text: reason ? reason.message : undefined,
duration: 5000, duration: 5000,
speed: 1000, speed: 1000,
@ -111,10 +111,10 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
protected [EVENT.SYSTEM.DISCONNECT]({ message }: DisconnectPayload) { protected [EVENT.SYSTEM.DISCONNECT]({ message }: DisconnectPayload) {
this.onDisconnected(new Error(message)) this.onDisconnected(new Error(message))
this.$vue.$swal({ this.$vue.$swal({
title: this.$vue.$t('disconnected'), title: this.$vue.$t('connection.disconnected'),
text: message, text: message,
icon: 'error', icon: 'error',
confirmButtonText: this.$vue.$t('ok') as string, confirmButtonText: this.$vue.$t('connection.button_confirm') as string,
}) })
} }
@ -125,7 +125,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.user.setMembers(members) this.$accessor.user.setMembers(members)
this.$accessor.chat.newMessage({ this.$accessor.chat.newMessage({
id: this.id, id: this.id,
content: this.$vue.$t('connected') as string, content: this.$vue.$t('notifications.connected', { name: '' }) as string,
type: 'event', type: 'event',
created: new Date(), created: new Date(),
}) })
@ -137,7 +137,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
if (member.id !== this.id) { if (member.id !== this.id) {
this.$accessor.chat.newMessage({ this.$accessor.chat.newMessage({
id: member.id, id: member.id,
content: this.$vue.$t('connected') as string, content: this.$vue.$t('notifications.connected', { name: '' }) as string,
type: 'event', type: 'event',
created: new Date(), created: new Date(),
}) })
@ -152,7 +152,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({ this.$accessor.chat.newMessage({
id: member.id, id: member.id,
content: this.$vue.$t('disconnected') as string, content: this.$vue.$t('notifications.disconnected', { name: '' }) as string,
type: 'event', type: 'event',
created: new Date(), created: new Date(),
}) })
@ -207,7 +207,7 @@ export class NekoClient extends BaseClient implements EventEmitter<NekoEvents> {
this.$accessor.chat.newMessage({ this.$accessor.chat.newMessage({
id: member.id, id: member.id,
content: this.$vue.$t('notifications.controls_released') as string, content: this.$vue.$t('notifications.controls_released', { name: '' }) as string,
type: 'event', type: 'event',
created: new Date(), created: new Date(),
}) })