From e78d96686c6146d969d96431cdd117da945072e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 30 Jan 2023 22:09:36 +0100 Subject: core: inform that commands are case sensitive when another command with different case is found (issue #1877) --- po/cs.po | 8 +++++++- po/de.po | 9 ++++++++- po/es.po | 8 +++++++- po/fr.po | 12 ++++++++++-- po/hu.po | 8 +++++++- po/it.po | 8 +++++++- po/ja.po | 8 +++++++- po/pl.po | 9 ++++++++- po/pt.po | 8 +++++++- po/pt_BR.po | 8 +++++++- po/ru.po | 8 +++++++- po/sr.po | 9 ++++++++- po/tr.po | 9 ++++++++- po/weechat.pot | 8 +++++++- src/core/hook/wee-hook-command.c | 11 +++++++++-- src/core/hook/wee-hook-command.h | 3 +++ 16 files changed, 117 insertions(+), 17 deletions(-) diff --git a/po/cs.po b/po/cs.po index d7b5fb5c5..b992b44f4 100644 --- a/po/cs.po +++ b/po/cs.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2022-10-15 22:51+0200\n" "Last-Translator: Ondřej Súkup \n" "Language-Team: weechat-dev \n" @@ -147,6 +147,12 @@ msgstr "" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "%sChyba: příkaz \"%s\" již existuje pro plugin \"%s\"" +#, fuzzy, c-format +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "%sChyba: neznámý příkaz \"%s\" (napište /help pro nápovědu)" + #, fuzzy, c-format msgid "" "%sUnknown command \"%s\" (type /help for help), commands with similar name: " diff --git a/po/de.po b/po/de.po index 196c18459..705eda43f 100644 --- a/po/de.po +++ b/po/de.po @@ -26,7 +26,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2023-01-29 13:05+0100\n" "Last-Translator: Nils Görs \n" "Language-Team: German - Germany \n" @@ -147,6 +147,13 @@ msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "" "%sEin anderer Befehl \"%s\" existiert bereits für die Erweiterung \"%s\"" +#, fuzzy, c-format +#| msgid "%sUnknown command \"%s\" (type /help for help)" +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "%sDer Befehl \"%s\" ist nicht bekannt (für eine Hilfe nutze /help)" + #, fuzzy, c-format #| msgid "%sUnknown command \"%s\" (type /help for help)" msgid "" diff --git a/po/es.po b/po/es.po index d27dda2d6..a16c23354 100644 --- a/po/es.po +++ b/po/es.po @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2022-10-15 22:51+0200\n" "Last-Translator: Santiago Forero \n" "Language-Team: weechat-dev \n" @@ -145,6 +145,12 @@ msgstr "" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "%sError: el comando \"%s\" ya existe en el plugin \"%s\"" +#, fuzzy, c-format +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "%sError: comando \"%s\" desconocido (use /help para ver la ayuda)" + #, fuzzy, c-format msgid "" "%sUnknown command \"%s\" (type /help for help), commands with similar name: " diff --git a/po/fr.po b/po/fr.po index 50480ce25..e684acbb0 100644 --- a/po/fr.po +++ b/po/fr.po @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" -"PO-Revision-Date: 2023-01-30 21:32+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" +"PO-Revision-Date: 2023-01-30 22:07+0100\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" "Language: fr\n" @@ -139,6 +139,14 @@ msgstr "Fichier" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "%sUne autre commande \"%s\" existe déjà pour l'extension \"%s\"" +#, c-format +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "" +"%sCommande \"%s\" inconnue (les commandes sont sensibles à la casse, tapez /" +"help pour l'aide), commandes avec un nom similaire : %s" + #, c-format msgid "" "%sUnknown command \"%s\" (type /help for help), commands with similar name: " diff --git a/po/hu.po b/po/hu.po index a7cb0f87e..27f96c3b3 100644 --- a/po/hu.po +++ b/po/hu.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2022-10-15 22:51+0200\n" "Last-Translator: Andras Voroskoi \n" "Language-Team: weechat-dev \n" @@ -147,6 +147,12 @@ msgstr "" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "%s az ignore már létezik\n" +#, fuzzy, c-format +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "%s a \"%s\" aliasz vagy parancs nem található\n" + #, fuzzy, c-format msgid "" "%sUnknown command \"%s\" (type /help for help), commands with similar name: " diff --git a/po/it.po b/po/it.po index 3d9979ded..d88a7e262 100644 --- a/po/it.po +++ b/po/it.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2022-10-15 22:51+0200\n" "Last-Translator: Esteban I. Ruiz Moreno \n" "Language-Team: weechat-dev \n" @@ -144,6 +144,12 @@ msgstr "" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "%sErrore: un altro comando \"%s\" esiste già per il plugin \"%s\"" +#, fuzzy, c-format +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "%sErrore: comando \"%s\" sconosciuto (digita /help per l'aiuto)" + #, fuzzy, c-format msgid "" "%sUnknown command \"%s\" (type /help for help), commands with similar name: " diff --git a/po/ja.po b/po/ja.po index f5eed819a..6bf471ff2 100644 --- a/po/ja.po +++ b/po/ja.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2022-10-15 22:51+0200\n" "Last-Translator: AYANOKOUZI, Ryuunosuke \n" "Language-Team: Japanese \n" "Language-Team: Polish \n" @@ -141,6 +141,13 @@ msgstr "" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "%sIstnieje już inna komenda \"%s\" dla wtyczki \"%s\"" +#, fuzzy, c-format +#| msgid "%sUnknown command \"%s\" (type /help for help)" +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "%sNieznana komenda \"%s\" (wpisz /help , aby uzyskać pomoc)" + #, fuzzy, c-format #| msgid "%sUnknown command \"%s\" (type /help for help)" msgid "" diff --git a/po/pt.po b/po/pt.po index cd3c556bc..f5576b79d 100644 --- a/po/pt.po +++ b/po/pt.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2022-10-15 22:51+0200\n" "Last-Translator: Vasco Almeida \n" "Language-Team: Portuguese <>\n" @@ -146,6 +146,12 @@ msgstr "" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "%sErro: outro comando \"%s\" já existe para o plugin \"%s\"" +#, fuzzy, c-format +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "%sErro: comando desconhecido: \"%s\" (escreva /help para obter ajuda)" + #, fuzzy, c-format msgid "" "%sUnknown command \"%s\" (type /help for help), commands with similar name: " diff --git a/po/pt_BR.po b/po/pt_BR.po index 4f3f8da3e..74b778984 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2022-10-15 22:51+0200\n" "Last-Translator: Érico Nogueira \n" "Language-Team: weechat-dev \n" @@ -143,6 +143,12 @@ msgstr "" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "%sOutro comando \"%s\" já existe para o plugin \"%s\"" +#, fuzzy, c-format +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "%sErro com o comando \"%s\" (ajuda no comando: /help %s)" + #, fuzzy, c-format msgid "" "%sUnknown command \"%s\" (type /help for help), commands with similar name: " diff --git a/po/ru.po b/po/ru.po index bad808969..c32738542 100644 --- a/po/ru.po +++ b/po/ru.po @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2022-10-15 22:51+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti \n" "Language-Team: weechat-dev \n" @@ -155,6 +155,12 @@ msgstr "" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "%s игнорирование уже существует\n" +#, fuzzy, c-format +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "%s сокращение или команда \"%s\" не найдены\n" + #, fuzzy, c-format msgid "" "%sUnknown command \"%s\" (type /help for help), commands with similar name: " diff --git a/po/sr.po b/po/sr.po index e7373fdab..3fab1c192 100644 --- a/po/sr.po +++ b/po/sr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2022-12-05 09:44+0400\n" "Last-Translator: Ivan Pešić \n" "Language-Team: weechat-dev \n" @@ -144,6 +144,13 @@ msgstr "" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "%sВећ постоји друга команда \"%s\" за додатак \"%s\"" +#, fuzzy, c-format +#| msgid "%sUnknown command \"%s\" (type /help for help)" +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "%sНепозната команда „%s” (за помоћ откуцајте /help)" + #, fuzzy, c-format #| msgid "%sUnknown command \"%s\" (type /help for help)" msgid "" diff --git a/po/tr.po b/po/tr.po index 97456fe95..525da5c89 100644 --- a/po/tr.po +++ b/po/tr.po @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2022-10-15 22:51+0200\n" "Last-Translator: Emir SARI \n" "Language-Team: weechat-dev \n" @@ -143,6 +143,13 @@ msgstr "" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "%sŞu eklenti için başka bir komut (\"%s\") halihazırda var: \"%s\"" +#, fuzzy, c-format +#| msgid "%sUnknown command \"%s\" (type /help for help)" +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "%s Bilinmeyen komut \"%s\" (yardım için /help yazın)" + #, fuzzy, c-format #| msgid "%sUnknown command \"%s\" (type /help for help)" msgid "" diff --git a/po/weechat.pot b/po/weechat.pot index a90ee12a8..8e16f6458 100644 --- a/po/weechat.pot +++ b/po/weechat.pot @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2023-01-30 21:30+0100\n" +"POT-Creation-Date: 2023-01-30 22:06+0100\n" "PO-Revision-Date: 2014-08-16 10:27+0200\n" "Last-Translator: Sébastien Helleu \n" "Language-Team: weechat-dev \n" @@ -131,6 +131,12 @@ msgstr "" msgid "%sAnother command \"%s\" already exists for plugin \"%s\"" msgstr "" +#, c-format +msgid "" +"%sUnknown command \"%s\" (commands are case sensitive, type /help for help), " +"commands with similar name: %s" +msgstr "" + #, c-format msgid "" "%sUnknown command \"%s\" (type /help for help), commands with similar name: " diff --git a/src/core/hook/wee-hook-command.c b/src/core/hook/wee-hook-command.c index dbe3b0653..55bc68a24 100644 --- a/src/core/hook/wee-hook-command.c +++ b/src/core/hook/wee-hook-command.c @@ -543,7 +543,7 @@ hook_command_similar_get_relevance (const char *cmd1, int length_cmd1, /* perfect match if commands are the same (different case) */ if (strcmp (cmd1, cmd2) == 0) - return -99; + return HOOK_COMMAND_SIMILAR_DIFF_CASE_ONLY; /* init relevance with Levenshtein distance (lower is better) */ relevance = string_levenshtein (cmd1, cmd2, 1); @@ -673,7 +673,7 @@ hook_command_display_error_unknown (const char *command) struct t_arraylist *list_commands; struct t_hook_command_similar *cmd_similar; char **str_commands; - int i, list_size, found; + int i, list_size, found, found_diff_case_only; if (!command || !command[0]) return; @@ -690,6 +690,7 @@ hook_command_display_error_unknown (const char *command) } found = 0; + found_diff_case_only = 0; list_size = arraylist_size (list_commands); for (i = 0; i < list_size; i++) { @@ -701,6 +702,8 @@ hook_command_display_error_unknown (const char *command) string_dyn_concat (str_commands, ", ", -1); string_dyn_concat (str_commands, cmd_similar->command, -1); found++; + if (cmd_similar->relevance == HOOK_COMMAND_SIMILAR_DIFF_CASE_ONLY) + found_diff_case_only++; if (found >= 5) break; } @@ -710,6 +713,10 @@ hook_command_display_error_unknown (const char *command) gui_chat_printf_date_tags ( NULL, 0, GUI_FILTER_TAG_NO_FILTER, + (found_diff_case_only > 0) ? + _("%sUnknown command \"%s\" (commands are case sensitive, " + "type /help for help), " + "commands with similar name: %s") : _("%sUnknown command \"%s\" (type /help for help), " "commands with similar name: %s"), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], diff --git a/src/core/hook/wee-hook-command.h b/src/core/hook/wee-hook-command.h index cec93e575..ab56ee3b0 100644 --- a/src/core/hook/wee-hook-command.h +++ b/src/core/hook/wee-hook-command.h @@ -37,6 +37,9 @@ struct t_gui_buffer; #define HOOK_COMMAND_EXEC_AMBIGUOUS_INCOMPLETE -3 #define HOOK_COMMAND_EXEC_RUNNING -4 +/* same command found with a different case */ +#define HOOK_COMMAND_SIMILAR_DIFF_CASE_ONLY -99 + typedef int (t_hook_callback_command)(const void *pointer, void *data, struct t_gui_buffer *buffer, int argc, char **argv, char **argv_eol); -- cgit v1.2.3