Skip to content

Commit cfd45f7

Browse files
authored
document locale fallbacks (#7237)
1 parent 68e58df commit cfd45f7

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

docs/interactions/Application_Commands.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,20 @@ An application command furnished with localizations might look like this:
10751075
}
10761076
```
10771077

1078+
### Locale fallbacks
1079+
1080+
For application commands, there are built-in fallbacks in case a user's locale isn't present in the localizations. If the fallback locale is also missing, it will use the default.
1081+
1082+
> warn
1083+
> You should make sure to include your default value in its proper locale key, otherwise it may use a fallback value unexpectedly. For example, if your default value is `en-US`, but you don't specify the `en-US` value in your localizations, users with `en-US` selected will see the `en-GB` value if it's specified.
1084+
> For example, if you have a command with the default name "color", and your localizations specify only the `en-GB` value as "colour", users in the `en-US` locale will see "colour" because the `en-US` key is missing.
1085+
1086+
| Locale | Fallback |
1087+
|--------|----------|
1088+
| en-US | en-GB |
1089+
| en-GB | en-US |
1090+
| es-419 | es-ES |
1091+
10781092
### Retrieving localized commands
10791093

10801094
While most endpoints that return application command objects will return the `name_localizations` and `description_localizations` fields, some will not by default. This includes `GET` endpoints that return all of an application's guild or global commands. Instead, those endpoints will supply additional `name_localized` or `description_localized` fields, which only contain the localization relevant to the requester's locale. (The full dictionaries can still be obtained by supplying the appropriate query argument).

0 commit comments

Comments
 (0)