You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/website/docs/guide/02-commands/03-context-menu-commands.mdx
+54Lines changed: 54 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -144,3 +144,57 @@ very similar to message context menu commands.
144
144
145
145
</TabItem>
146
146
</Tabs>
147
+
148
+
You may have noticed that the context menu command names are the same as the message command names.
149
+
This is because the context menu command names are borrowed from the non-context menu command names.
150
+
151
+
In order to change the context menu command name, you can use the `nameAliases` option in the `CommandMetadata` object.
152
+
153
+
:::warning
154
+
155
+
If you are using the [i18n plugin](../05-official-plugins/05-commandkit-i18n.mdx), the plugin will add `name_localizations` to the `nameAliases` option if localization for the context menu command name is provided.
156
+
157
+
```json title="src/app/locales/en/command.json"
158
+
{
159
+
"$command": {
160
+
"name": "Report", // this will add `name_localizations` to the regular command name
161
+
"description": "Report a message or user to moderators."// this will add `description_localizations` to the regular command description
162
+
},
163
+
"$command:user-ctx": {
164
+
"name": "Report User"// this will add `name_localizations` to the `nameAliases.user` option
165
+
},
166
+
"$command:message-ctx": {
167
+
"name": "Report Message"// this will add `name_localizations` to the `nameAliases.message` option
* The name aliases for the `user` and `message` context menu commands. When i18n plugin is in use, this option will be ignored if the translation for the context menu command name is provided.
Copy file name to clipboardExpand all lines: packages/i18n/README.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -66,12 +66,20 @@ If your translation file contains `$command` key with localization object, it wi
66
66
}
67
67
]
68
68
},
69
+
"$command:user-ctx": {
70
+
"name": "Ping"
71
+
},
72
+
"$command:message-ctx": {
73
+
"name": "Ping"
74
+
},
69
75
"response": "Pong! The latency is {{latency}}ms"
70
76
}
71
77
```
72
78
73
79
The `$command` key defines localization for the command name and description (or options). These properties are later merged with the actual command to build the final command object with localizations that Discord understands. Anything else in the translation file is used to localize the command response.
74
80
81
+
The `$command:user-ctx` and `$command:message-ctx` keys define localization for the user context menu and message context menu command names.
82
+
75
83
This plugin adds `locale()` function to your command context. You can use it to localize your command responses.
0 commit comments