From 306b9fdd71073f30f1d2d442adac3e8fda0b990c Mon Sep 17 00:00:00 2001 From: JC Brand Date: Mon, 17 Aug 2020 08:53:08 +0200 Subject: [PATCH] Updates #2193 Also remove top-level i18n declarations in components --- src/components/adhoc-commands.js | 107 ++++++++++++++++--------------- src/components/message.js | 10 +-- src/components/toolbar.js | 14 ++-- src/converse-muc-views.js | 2 +- 4 files changed, 67 insertions(+), 66 deletions(-) diff --git a/src/components/adhoc-commands.js b/src/components/adhoc-commands.js index b6b1daaf8..a416b0314 100644 --- a/src/components/adhoc-commands.js +++ b/src/components/adhoc-commands.js @@ -10,34 +10,28 @@ import { unsafeHTML } from 'lit-html/directives/unsafe-html.js'; const { Strophe, $iq } = converse.env; const u = converse.env.utils; -const i18n_hide = __('Hide'); -const i18n_choose_service = __('On which entity do you want to run commands?'); -const i18n_choose_service_instructions = __( - 'Certain XMPP services and entities allow privileged users to execute ad-hoc commands on them.'); -const i18n_commands_found = __('Commands found'); -const i18n_fetch_commands = __('List available commands'); -const i18n_jid_placeholder = __('XMPP Address'); -const i18n_no_commands_found = __('No commands found'); -const i18n_run = __('Execute'); +const tpl_command_form = (o, command) => { + const i18n_hide = __('Hide'); + const i18n_run = __('Execute'); + return html` +
+ ${ command.alert ? html`` : '' } +
+ + -const tpl_command_form = (o, command) => html` - - ${ command.alert ? html`` : '' } -
- - - -

${command.instructions}

- - ${ command.fields.map(field => unsafeHTML(field)) } -
-
- - -
- -`; +

${command.instructions}

+ + ${ command.fields.map(field => unsafeHTML(field)) } +
+
+ + +
+ + `; +} const tpl_command = (o, command) => html` @@ -62,33 +56,42 @@ async function getAutoCompleteList () { return jids; } -const tpl_adhoc = (o) => html` - ${ o.alert ? html`` : '' } -
-
- -
-
- -
- ${ o.view === 'list-commands' ? html` -
-
    -
  • ${ o.commands.length ? i18n_commands_found : i18n_no_commands_found }:
  • - ${ o.commands.map(cmd => tpl_command(o, cmd)) } -
-
` - : '' } +const tpl_adhoc = (o) => { + const i18n_choose_service = __('On which entity do you want to run commands?'); + const i18n_choose_service_instructions = __( + 'Certain XMPP services and entities allow privileged users to execute ad-hoc commands on them.'); + const i18n_commands_found = __('Commands found'); + const i18n_fetch_commands = __('List available commands'); + const i18n_jid_placeholder = __('XMPP Address'); + const i18n_no_commands_found = __('No commands found'); + return html` + ${ o.alert ? html`` : '' } + +
+ +
+
+ +
+ ${ o.view === 'list-commands' ? html` +
+
    +
  • ${ o.commands.length ? i18n_commands_found : i18n_no_commands_found }:
  • + ${ o.commands.map(cmd => tpl_command(o, cmd)) } +
+
` + : '' } -
-`; + + `; +} async function fetchCommandForm (command) { diff --git a/src/components/message.js b/src/components/message.js index 5b8868359..2b45abd1a 100644 --- a/src/components/message.js +++ b/src/components/message.js @@ -16,11 +16,6 @@ import { renderAvatar } from './../templates/directives/avatar'; const { Strophe } = converse.env; const u = converse.env.utils; -const i18n_edited = __('This message has been edited'); -const i18n_show = __('Show more'); -const i18n_show_less = __('Show less'); -const i18n_uploading = __('Uploading file:'); - export default class Message extends CustomElement { @@ -112,6 +107,7 @@ export default class Message extends CustomElement { } renderFileProgress () { + const i18n_uploading = __('Uploading file:'); const filename = this.model.file.name; const size = filesize(this.model.file.size); return html` @@ -214,7 +210,11 @@ export default class Message extends CustomElement { } renderMessageText () { + const i18n_edited = __('This message has been edited'); + const i18n_show = __('Show more'); const is_groupchat_message = (this.message_type === 'groupchat'); + const i18n_show_less = __('Show less'); + const tpl_spoiler_hint = html`
${this.spoiler_hint} diff --git a/src/components/toolbar.js b/src/components/toolbar.js index 4108bcc0c..e9254be34 100644 --- a/src/components/toolbar.js +++ b/src/components/toolbar.js @@ -7,13 +7,6 @@ import { until } from 'lit-html/directives/until.js'; const Strophe = converse.env.Strophe -const i18n_chars_remaining = __('Message characters remaining'); -const i18n_choose_file = __('Choose a file to send') -const i18n_hide_occupants = __('Hide occupants'); -const i18n_send_message = __('Send the message'); -const i18n_show_occupants = __('Show occupants'); -const i18n_start_call = __('Start a call'); - export class ChatToolbar extends CustomElement { @@ -35,6 +28,7 @@ export class ChatToolbar extends CustomElement { } render () { + const i18n_send_message = __('Send the message'); return html` ${ this.show_toolbar ? html`${until(this.getButtons(), '')}` : '' } ${ this.show_send_button ? html`` : '' } @@ -49,12 +43,14 @@ export class ChatToolbar extends CustomElement { } if (this.show_call_button) { + const i18n_start_call = __('Start a call'); buttons.push(html` ` ); } + const i18n_chars_remaining = __('Message characters remaining'); const message_limit = api.settings.get('message_limit'); if (message_limit) { buttons.push(html`${this.message_limit}`); @@ -68,6 +64,8 @@ export class ChatToolbar extends CustomElement { buttons.push(html`${until(http_upload_promise.then(is_supported => this.getHTTPUploadButton(is_supported)),'')}`); if (this.show_occupants_toggle) { + const i18n_hide_occupants = __('Hide participants'); + const i18n_show_occupants = __('Show participants'); buttons.push(html`