From 55ef9536c5000ebd751b6fa6836dd206d136c4c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Fri, 8 Sep 2023 21:21:43 +0200 Subject: [PATCH] irc: format and translate commands line by line (issue #2005) --- src/plugins/irc/irc-command.c | 1133 +++++++++++++++++---------------- 1 file changed, 579 insertions(+), 554 deletions(-) diff --git a/src/plugins/irc/irc-command.c b/src/plugins/irc/irc-command.c index 8d1de6243..09b9e289f 100644 --- a/src/plugins/irc/irc-command.c +++ b/src/plugins/irc/irc-command.c @@ -6858,9 +6858,10 @@ irc_command_init () N_("send a CTCP action to a nick or channel"), /* TRANSLATORS: only text between angle brackets (eg: "") must be translated */ N_("[-server ] [,...] "), - N_("server: send to this server (internal name)\n" - "target: nick or channel (may be mask, '*' = current channel)\n" - " text: text to send"), + WEECHAT_CMD_ARGS_DESC( + N_("server: send to this server (internal name)"), + N_("target: nick or channel (may be mask, \"*\" = current channel)"), + N_("text: text to send")), "-server %(irc_servers) %(nicks)|*" " || %(nicks)|*", &irc_command_action, NULL, NULL); @@ -6869,7 +6870,8 @@ irc_command_init () N_("find information about the administrator of the server"), /* TRANSLATORS: only text between angle brackets (eg: "") must be translated */ N_("[]"), - N_("target: server name"), + WEECHAT_CMD_ARGS_DESC( + N_("target: server name")), NULL, &irc_command_admin, NULL, NULL); weechat_hook_command ( "allchan", @@ -6877,33 +6879,28 @@ irc_command_init () /* TRANSLATORS: only text between angle brackets (eg: "") must be translated */ N_("[-current] [-parted] [-exclude=[,...]] " " || [-current] [-parted] -include=[,...] "), - N_(" -current: execute command for channels of current server only\n" - " -parted: execute on parted channels only\n" - " -exclude: exclude some channels (wildcard \"*\" is allowed)\n" - " -include: include only some channels (wildcard \"*\" is allowed)\n" - " command: command to execute (or text to send to buffer if " - "command does not start with '/')\n" - "\n" - "Command and arguments are evaluated (see /help eval), the following " - "variables are replaced:\n" - " $server server name\n" - " $channel channel name\n" - " $nick nick on server\n" - " ${irc_server.xxx} variable xxx in server\n" - " ${irc_channel.xxx} variable xxx in channel\n" - "\n" - "Examples:\n" - " execute '/me is testing' on all channels:\n" - " /allchan /me is testing\n" - " say 'hello' everywhere but not on #weechat:\n" - " /allchan -exclude=#weechat hello\n" - " say 'hello' everywhere but not on #weechat and channels beginning " - "with #linux:\n" - " /allchan -exclude=#weechat,#linux* hello\n" - " say 'hello' on all channels beginning with #linux:\n" - " /allchan -include=#linux* hello\n" - " close all buffers with parted channels:\n" - " /allchan -parted /close"), + WEECHAT_CMD_ARGS_DESC( + N_("raw[-current]: execute command for channels of current server only"), + N_("raw[-parted]: execute on parted channels only"), + N_("raw[-exclude]: exclude some channels (wildcard \"*\" is allowed)"), + N_("raw[-include]: include only some channels (wildcard \"*\" is allowed)"), + N_("command: command to execute (or text to send to buffer if " + "command does not start with \"/\")"), + "", + N_("Command and arguments are evaluated (see /help eval), the following " + "variables are replaced:"), + N_(" $server: server name"), + N_(" $channel: channel name"), + N_(" $nick: nick on server"), + N_(" ${irc_server.xxx}: variable xxx in server"), + N_(" ${irc_channel.xxx}: variable xxx in channel"), + "", + N_("Examples:"), + AI(" /allchan /me is testing"), + AI(" /allchan -exclude=#weechat hello"), + AI(" /allchan -exclude=#weechat,#linux* hello"), + AI(" /allchan -include=#linux* hello"), + AI(" /allchan -parted /close")), "-current|-parted", &irc_command_allchan, NULL, NULL); weechat_hook_command ( "allpv", @@ -6911,33 +6908,28 @@ irc_command_init () /* TRANSLATORS: only text between angle brackets (eg: "") must be translated */ N_("[-current] [-exclude=[,...]] " " || [-current] -include=[,...] "), - N_(" -current: execute command for private buffers of current server " - "only\n" - " -exclude: exclude some nicks (wildcard \"*\" is allowed)\n" - " -include: include only some nicks (wildcard \"*\" is allowed)\n" - " command: command to execute (or text to send to buffer if " - "command does not start with '/')\n" - "\n" - "Command and arguments are evaluated (see /help eval), the following " - "variables are replaced:\n" - " $server server name\n" - " $channel channel name\n" - " $nick nick on server\n" - " ${irc_server.xxx} variable xxx in server\n" - " ${irc_channel.xxx} variable xxx in channel\n" - "\n" - "Examples:\n" - " execute '/me is testing' on all private buffers:\n" - " /allpv /me is testing\n" - " say 'hello' everywhere but not for nick foo:\n" - " /allpv -exclude=foo hello\n" - " say 'hello' everywhere but not for nick foo and nicks beginning " - "with bar:\n" - " /allpv -exclude=foo,bar* hello\n" - " say 'hello' for all nicks beginning with bar:\n" - " /allpv -include=bar* hello\n" - " close all private buffers:\n" - " /allpv /close"), + WEECHAT_CMD_ARGS_DESC( + N_("raw[-current]: execute command for private buffers of current server " + "only"), + N_("raw[-exclude]: exclude some nicks (wildcard \"*\" is allowed)"), + N_("raw[-include]: include only some nicks (wildcard \"*\" is allowed)"), + N_("command: command to execute (or text to send to buffer if " + "command does not start with \"/\")"), + "", + N_("Command and arguments are evaluated (see /help eval), the following " + "variables are replaced:"), + N_(" $server: server name"), + N_(" $channel: channel name"), + N_(" $nick: nick on server"), + N_(" ${irc_server.xxx}: variable xxx in server"), + N_(" ${irc_channel.xxx}: variable xxx in channel"), + "", + N_("Examples:"), + AI(" /allpv /me is testing"), + AI(" /allpv -exclude=foo hello"), + AI(" /allpv -exclude=foo,bar* hello"), + AI(" /allpv -include=bar* hello"), + AI(" /allpv /close")), "-current", &irc_command_allpv, NULL, NULL); weechat_hook_command ( "allserv", @@ -6946,50 +6938,48 @@ irc_command_init () N_("[-exclude=[,...]] " " || -include=[,...] " ""), - N_(" -exclude: exclude some servers (wildcard \"*\" is allowed)\n" - " -include: include only some servers (wildcard \"*\" is allowed)\n" - " command: command to execute (or text to send to buffer if " - "command does not start with '/')\n" - "\n" - "Command and arguments are evaluated (see /help eval), the following " - "variables are replaced:\n" - " $server server name\n" - " $nick nick on server\n" - " ${irc_server.xxx} variable xxx in server\n" - "\n" - "Examples:\n" - " change nick on all servers:\n" - " /allserv /nick newnick\n" - " set away on all servers:\n" - " /allserv /away I'm away\n" - " do a whois on my nick on all servers:\n" - " /allserv /whois $nick"), + WEECHAT_CMD_ARGS_DESC( + N_("raw[-exclude]: exclude some servers (wildcard \"*\" is allowed)"), + N_("raw[-include]: include only some servers (wildcard \"*\" is allowed)"), + N_("command: command to execute (or text to send to buffer if " + "command does not start with \"/\")"), + "", + N_("Command and arguments are evaluated (see /help eval), the following " + "variables are replaced:"), + N_(" $server: server name"), + N_(" $nick: nick on server"), + N_(" ${irc_server.xxx}: variable xxx in server"), + "", + N_("Examples:"), + AI(" /allserv /nick newnick"), + AI(" /allserv /away I'm away"), + AI(" /allserv /whois $nick")), NULL, &irc_command_allserv, NULL, NULL); weechat_hook_command ( "auth", N_("authenticate with SASL"), /* TRANSLATORS: only text between angle brackets (eg: "") must be translated */ N_("[ ]"), - N_("username: SASL username (content is evaluated, see /help eval; " - "server options are evaluated with ${irc_server.xxx} and ${server} " - "is replaced by the server name)\n" - "password: SASL password or path to file with private key " - "(content is evaluated, see /help eval; server options are " - "evaluated with ${irc_server.xxx} and ${server} is replaced by the " - "server name)\n" - "\n" - "If username and password are not provided, the values from server " - "options \"sasl_username\" and \"sasl_password\" (or \"sasl_key\") " - "are used.\n" - "\n" - "Examples:\n" - " authenticate with username/password defined in the server:\n" - " /auth\n" - " authenticate as a different user:\n" - " /auth user2 password2\n" - " authenticate as a different user with mechanism " - "ecdsa-nist256p-challenge:\n" - " /auth user2 ${weechat_config_dir}/ecdsa2.pem"), + WEECHAT_CMD_ARGS_DESC( + N_("username: SASL username (content is evaluated, see /help eval; " + "server options are evaluated with ${irc_server.xxx} and ${server} " + "is replaced by the server name)"), + N_("password: SASL password or path to file with private key " + "(content is evaluated, see /help eval; server options are " + "evaluated with ${irc_server.xxx} and ${server} is replaced by the " + "server name)"), + "", + N_("If username and password are not provided, the values from server " + "options \"sasl_username\" and \"sasl_password\" (or \"sasl_key\") " + "are used."), + "", + N_("Examples:"), + N_(" authenticate with username/password defined in the server:"), + AI(" /auth"), + N_(" authenticate as a different user:"), + AI(" /auth user2 password2"), + N_(" authenticate as a different user with mechanism ecdsa-nist256p-challenge:"), + AI(" /auth user2 ${weechat_config_dir}/ecdsa2.pem")), NULL, &irc_command_auth, NULL, NULL); weechat_hook_command ( "autojoin", @@ -7001,32 +6991,33 @@ irc_command_init () " || apply" " || join" " || sort [buffer]"), - N_(" add: add current channel or a list of channels (with optional " - "keys) to the autojoin option; if you are on the channel and the " - "key is not provided, the key is read in the channel\n" - " addraw: use the IRC raw format (same as /join command): all " - "channels separated by commas, optional keys separated by commas\n" - " del: delete current channel or a list of channels from the " - "autojoin option\n" - "channel: channel name\n" - " key: key for the channel\n" - " apply: set currently joined channels in the autojoin option\n" - " join: join the channels in the autojoin option\n" - " sort: sort alphabetically channels in the autojoin option; " - "with \"buffer\": first sort by buffer number, then alphabetically\n" - "\n" - "Examples:\n" - " /autojoin add\n" - " /autojoin add #test\n" - " /autojoin add #chan1 #chan2\n" - " /allchan /autojoin add\n" - " /autojoin addraw #chan1,#chan2,#chan3 key1,key2\n" - " /autojoin del\n" - " /autojoin del #chan1\n" - " /autojoin apply\n" - " /autojoin join\n" - " /autojoin sort\n" - " /autojoin sort buffer"), + WEECHAT_CMD_ARGS_DESC( + N_("raw[add]: add current channel or a list of channels (with optional " + "keys) to the autojoin option; if you are on the channel and the " + "key is not provided, the key is read in the channel"), + N_("raw[addraw]: use the IRC raw format (same as /join command): all " + "channels separated by commas, optional keys separated by commas"), + N_("raw[del]: delete current channel or a list of channels from the " + "autojoin option"), + N_("channel: channel name"), + N_("key: key for the channel"), + N_("raw[apply]: set currently joined channels in the autojoin option"), + N_("raw[join]: join the channels in the autojoin option"), + N_("raw[sort]: sort alphabetically channels in the autojoin option; " + "with \"buffer\": first sort by buffer number, then alphabetically"), + "", + N_("Examples:"), + AI(" /autojoin add"), + AI(" /autojoin add #test"), + AI(" /autojoin add #chan1 #chan2"), + AI(" /allchan /autojoin add"), + AI(" /autojoin addraw #chan1,#chan2,#chan3 key1,key2"), + AI(" /autojoin del"), + AI(" /autojoin del #chan1"), + AI(" /autojoin apply"), + AI(" /autojoin join"), + AI(" /autojoin sort"), + AI(" /autojoin sort buffer")), "add %(irc_channels)|%*" " || addraw %(irc_channels) %-" " || del %(irc_channels_autojoin)|%*" @@ -7040,11 +7031,12 @@ irc_command_init () N_("ban nicks or hosts"), /* TRANSLATORS: only text between angle brackets (eg: "") must be translated */ N_("[] [ [...]]"), - N_("channel: channel name\n" - " nick: nick or host\n" - "\n" - "Without argument, this command displays the ban list for current " - "channel."), + WEECHAT_CMD_ARGS_DESC( + N_("channel: channel name"), + N_("nick: nick or host"), + "", + N_("Without argument, this command displays the ban list for current " + "channel.")), "%(irc_channel_nicks_hosts)", &irc_command_ban, NULL, NULL); weechat_hook_command ( "cap", @@ -7054,35 +7046,36 @@ irc_command_init () " || list" " || req|ack [ [...]]" " || end"), - N_(" ls: list the capabilities supported by the server\n" - " list: list the capabilities currently enabled\n" - " req: request a new capability or remove a capability " - "(if starting with \"-\", for example: \"-multi-prefix\")\n" - " ack: acknowledge capabilities which require client-side " - "acknowledgement\n" - " end: end the capability negotiation\n" - "\n" - "Without argument, \"ls\" and \"list\" are sent.\n" - "\n" - "Capabilities supported by WeeChat are: " - "account-notify, account-tag, away-notify, batch, cap-notify, " - "chghost, draft/multiline, echo-message, extended-join, " - "invite-notify, message-tags, multi-prefix, server-time, setname, " - "userhost-in-names.\n" - "\n" - "The capabilities to automatically enable on servers can be set " - "in option irc.server_default.capabilities (or by server in " - "option irc.server.xxx.capabilities).\n" - "\n" - "Examples:\n" - " display supported and enabled capabilities:\n" - " /cap\n" - " request capabilities multi-prefix and away-notify:\n" - " /cap req multi-prefix away-notify\n" - " request capability extended-join, remove capability multi-prefix:\n" - " /cap req extended-join -multi-prefix\n" - " remove capability away-notify:\n" - " /cap req -away-notify"), + WEECHAT_CMD_ARGS_DESC( + N_("raw[ls]: list the capabilities supported by the server"), + N_("raw[list]: list the capabilities currently enabled"), + N_("raw[req]: request a new capability or remove a capability " + "(if starting with \"-\", for example: \"-multi-prefix\")"), + N_("raw[ack]: acknowledge capabilities which require client-side " + "acknowledgement"), + N_("raw[end]: end the capability negotiation"), + "", + N_("Without argument, \"ls\" and \"list\" are sent."), + "", + N_("Capabilities supported by WeeChat are: " + "account-notify, account-tag, away-notify, batch, cap-notify, " + "chghost, draft/multiline, echo-message, extended-join, " + "invite-notify, message-tags, multi-prefix, server-time, setname, " + "userhost-in-names."), + "", + N_("The capabilities to automatically enable on servers can be set " + "in option irc.server_default.capabilities (or by server in " + "option irc.server.xxx.capabilities)."), + "", + N_("Examples:"), + N_(" display supported and enabled capabilities:"), + AI(" /cap"), + N_(" request capabilities multi-prefix and away-notify:"), + AI(" /cap req multi-prefix away-notify"), + N_(" request capability extended-join, remove capability multi-prefix:"), + AI(" /cap req extended-join -multi-prefix"), + N_(" remove capability away-notify:"), + AI(" /cap req -away-notify")), "ls" " || list" " || req " IRC_COMMAND_CAP_SUPPORTED "|%*" @@ -7096,37 +7089,36 @@ irc_command_init () N_("[ [...]] [-