Skip to content

Commit 316b157

Browse files
committed
refactor(trads): add all i18n keys for snippets implementation
1 parent 6c976d1 commit 316b157

2 files changed

Lines changed: 63 additions & 5 deletions

File tree

rustmail/src/i18n/language/en.rs

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ pub fn load_english_messages(dict: &mut ErrorDictionary) {
9797
DictionaryMessage::new("Failed to create thread")
9898
.with_description("An error occurred while creating the support thread"),
9999
);
100+
dict.messages.insert(
101+
"snippet.already_exist".to_string(),
102+
DictionaryMessage::new("The snippet with key '{key}' already exists."),
103+
);
100104
dict.messages.insert(
101105
"thread.user_still_in_server".to_string(),
102106
DictionaryMessage::new("User still in the server.")
@@ -722,6 +726,10 @@ pub fn load_english_messages(dict: &mut ErrorDictionary) {
722726
"slash_command.reply_message_argument_description".to_string(),
723727
DictionaryMessage::new("The content of the message to send to the user"),
724728
);
729+
dict.messages.insert(
730+
"slash_command.reply_snippet_argument_description".to_string(),
731+
DictionaryMessage::new("Use a snippet instead of typing a message"),
732+
);
725733
dict.messages.insert(
726734
"slash_command.reply_attachment_argument_description".to_string(),
727735
DictionaryMessage::new("An optional attachment to send to the user"),
@@ -952,11 +960,25 @@ pub fn load_english_messages(dict: &mut ErrorDictionary) {
952960
DictionaryMessage::new("## Latency\n\nGateway latency: **{gateway_latency}** ms\nMinimal REST latency (GET /gateway): **{api_latency}** ms\nREST latency (message send): **{message_latency}** ms"),
953961
);
954962

955-
// Snippet commands
956963
dict.messages.insert(
957964
"slash_command.snippet_command_description".to_string(),
958965
DictionaryMessage::new("Manage message snippets/templates"),
959966
);
967+
dict.messages.insert(
968+
"slash_command.snippet_command_help".to_string(),
969+
DictionaryMessage::new(
970+
"Manage message snippets/templates\n\n\
971+
**Subcommands:**\n\
972+
• `/snippet create <key> <content>` - Create a new snippet\n\
973+
• `/snippet list` - List all available snippets\n\
974+
• `/snippet show <key>` - Display a specific snippet's content\n\
975+
• `/snippet edit <key> <content>` - Update an existing snippet\n\
976+
• `/snippet delete <key>` - Delete a snippet\n\n\
977+
**Usage:**\n\
978+
• Slash command: `/reply snippet:<key>`\n\
979+
• Text command: `!reply {{key}}`",
980+
),
981+
);
960982
dict.messages.insert(
961983
"slash_command.snippet_create_description".to_string(),
962984
DictionaryMessage::new("Create a new snippet"),
@@ -992,7 +1014,9 @@ pub fn load_english_messages(dict: &mut ErrorDictionary) {
9921014

9931015
dict.messages.insert(
9941016
"snippet.invalid_key_format".to_string(),
995-
DictionaryMessage::new("Snippet key must contain only alphanumeric characters, dashes, and underscores."),
1017+
DictionaryMessage::new(
1018+
"Snippet key must contain only alphanumeric characters, dashes, and underscores.",
1019+
),
9961020
);
9971021
dict.messages.insert(
9981022
"snippet.content_too_long".to_string(),
@@ -1030,6 +1054,10 @@ pub fn load_english_messages(dict: &mut ErrorDictionary) {
10301054
"snippet.list_empty".to_string(),
10311055
DictionaryMessage::new("No snippets found."),
10321056
);
1057+
dict.messages.insert(
1058+
"snippet.no_snippets_found".to_string(),
1059+
DictionaryMessage::new("No snippets found."),
1060+
);
10331061
dict.messages.insert(
10341062
"snippet.list_title".to_string(),
10351063
DictionaryMessage::new("📝 Available Snippets"),
@@ -1076,6 +1104,8 @@ pub fn load_english_messages(dict: &mut ErrorDictionary) {
10761104
);
10771105
dict.messages.insert(
10781106
"snippet.unknown_text_subcommand".to_string(),
1079-
DictionaryMessage::new("Unknown subcommand. Use: `create`, `list`, `show`, `edit`, or `delete`"),
1107+
DictionaryMessage::new(
1108+
"Unknown subcommand. Use: `create`, `list`, `show`, `edit`, or `delete`",
1109+
),
10801110
);
10811111
}

rustmail/src/i18n/language/fr.rs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,10 @@ pub fn load_french_messages(dict: &mut ErrorDictionary) {
748748
"slash_command.reply_message_argument_description".to_string(),
749749
DictionaryMessage::new("Le message à envoyer à l'utilisateur"),
750750
);
751+
dict.messages.insert(
752+
"slash_command.reply_snippet_argument_description".to_string(),
753+
DictionaryMessage::new("Utiliser un snippet au lieu d'écrire un message"),
754+
);
751755
dict.messages.insert(
752756
"slash_command.reply_attachment_argument_description".to_string(),
753757
DictionaryMessage::new("Une pièce jointe à envoyer avec le message"),
@@ -967,11 +971,25 @@ pub fn load_french_messages(dict: &mut ErrorDictionary) {
967971
DictionaryMessage::new("## Latence\n\nLatence Gateway : **{gateway_latency}** ms.\nLatence REST minimale (GET /gateway) : **{api_latency}** ms.\nLatence REST (envoi d'un message) : **{message_latency}** ms."),
968972
);
969973

970-
// Commandes snippet
971974
dict.messages.insert(
972975
"slash_command.snippet_command_description".to_string(),
973976
DictionaryMessage::new("Gérer les snippets/modèles de messages"),
974977
);
978+
dict.messages.insert(
979+
"slash_command.snippet_command_help".to_string(),
980+
DictionaryMessage::new(
981+
"Gérer les snippets/modèles de messages\n\n\
982+
**Sous-commandes :**\n\
983+
• `/snippet create <clé> <contenu>` - Créer un nouveau snippet\n\
984+
• `/snippet list` - Lister tous les snippets disponibles\n\
985+
• `/snippet show <clé>` - Afficher le contenu d'un snippet spécifique\n\
986+
• `/snippet edit <clé> <contenu>` - Modifier un snippet existant\n\
987+
• `/snippet delete <clé>` - Supprimer un snippet\n\n\
988+
**Utilisation :**\n\
989+
• Commande slash : `/reply snippet:<clé>`\n\
990+
• Commande texte : `!reply {{clé}}`",
991+
),
992+
);
975993
dict.messages.insert(
976994
"slash_command.snippet_create_description".to_string(),
977995
DictionaryMessage::new("Créer un nouveau snippet"),
@@ -1021,6 +1039,10 @@ pub fn load_french_messages(dict: &mut ErrorDictionary) {
10211039
"snippet.creation_failed".to_string(),
10221040
DictionaryMessage::new("Échec de la création du snippet : {error}"),
10231041
);
1042+
dict.messages.insert(
1043+
"snippet.already_exist".to_string(),
1044+
DictionaryMessage::new("Le snippet `{key}` existe déjà."),
1045+
);
10241046
dict.messages.insert(
10251047
"snippet.updated".to_string(),
10261048
DictionaryMessage::new("Snippet `{key}` modifié avec succès !"),
@@ -1045,6 +1067,10 @@ pub fn load_french_messages(dict: &mut ErrorDictionary) {
10451067
"snippet.list_empty".to_string(),
10461068
DictionaryMessage::new("Aucun snippet trouvé."),
10471069
);
1070+
dict.messages.insert(
1071+
"snippet.no_snippets_found".to_string(),
1072+
DictionaryMessage::new("Aucun snippet trouvé."),
1073+
);
10481074
dict.messages.insert(
10491075
"snippet.list_title".to_string(),
10501076
DictionaryMessage::new("📝 Snippets disponibles"),
@@ -1091,6 +1117,8 @@ pub fn load_french_messages(dict: &mut ErrorDictionary) {
10911117
);
10921118
dict.messages.insert(
10931119
"snippet.unknown_text_subcommand".to_string(),
1094-
DictionaryMessage::new("Sous-commande inconnue. Utilisez : `create`, `list`, `show`, `edit`, ou `delete`"),
1120+
DictionaryMessage::new(
1121+
"Sous-commande inconnue. Utilisez : `create`, `list`, `show`, `edit`, ou `delete`",
1122+
),
10951123
);
10961124
}

0 commit comments

Comments
 (0)