Translate log entries and chat message placeholder

This commit is contained in:
Jérôme Lebleu 2020-05-08 15:37:44 +02:00
parent 56262ca895
commit 0b2d773ff6
2 changed files with 21 additions and 8 deletions

View file

@ -353,7 +353,7 @@ class GlobalBindings {
this.remoteHost(host) this.remoteHost(host)
this.remotePort(port) this.remotePort(port)
log('Connecting to server ', host) log(translate('logentry.connecting'), host)
// Note: This call needs to be delayed until the user has interacted with // Note: This call needs to be delayed until the user has interacted with
// the page in some way (which at this point they have), see: https://goo.gl/7K7WLu // the page in some way (which at this point they have), see: https://goo.gl/7K7WLu
@ -365,12 +365,12 @@ class GlobalBindings {
password: password, password: password,
tokens: tokens tokens: tokens
}).done(client => { }).done(client => {
log('Connected!') log(translate('logentry.connected'))
this.client = client this.client = client
// Prepare for connection errors // Prepare for connection errors
client.on('error', (err) => { client.on('error', (err) => {
log('Connection error:', err) log(translate('logentry.connection_error'), err)
this.resetClient() this.resetClient()
}) })
@ -444,7 +444,7 @@ class GlobalBindings {
this.connectErrorDialog.reason(err.reason) this.connectErrorDialog.reason(err.reason)
this.connectErrorDialog.show() this.connectErrorDialog.show()
} else { } else {
log('Connection error:', err) log(translate('logentry.connection_error'), err)
} }
}) })
} }
@ -716,7 +716,7 @@ class GlobalBindings {
} else if (mode === 'vad') { } else if (mode === 'vad') {
voiceHandler = new VADVoiceHandler(this.client, this.settings) voiceHandler = new VADVoiceHandler(this.client, this.settings)
} else { } else {
log('Unknown voice mode:', mode) log(translate('logentry.unknown_voice_mode'), mode)
return return
} }
voiceHandler.on('started_talking', () => { voiceHandler.on('started_talking', () => {
@ -751,9 +751,11 @@ class GlobalBindings {
target = target.channel() target = target.channel()
} }
if (target.users) { // Channel if (target.users) { // Channel
return "Type message to channel '" + target.name() + "' here" return translate('chat.channel_message_placeholder')
.replace('%1', target.name())
} else { // User } else { // User
return "Type message to user '" + target.name() + "' here" return translate('chat.user_message_placeholder')
.replace('%1', target.name())
} }
}) })
@ -1141,7 +1143,7 @@ async function main() {
voiceHandler.write(data) voiceHandler.write(data)
} }
}, err => { }, err => {
log('Cannot initialize user media. Microphone will not work:', err) log(translate('logentry.mic_init_error'), err)
}) })
} }

View file

@ -61,6 +61,17 @@
"copy_mumble_url": "Copy Mumble URL", "copy_mumble_url": "Copy Mumble URL",
"copy_mumble_web_url": "Copy Mumble-Web URL", "copy_mumble_web_url": "Copy Mumble-Web URL",
"send_message": "Send Message" "send_message": "Send Message"
},
"logentry": {
"connecting": "Connecting to server",
"connected": "Connected!",
"connection_error": "Connection error:",
"unknown_voice_mode": "Unknown voice mode:",
"mic_init_error": "Cannot initialize user media. Microphone will not work:"
},
"chat": {
"channel_message_placeholder": "Type message to channel '%1' here",
"user_message_placeholder": "Type message to user '%1' here"
} }
} }