Skip to content

Commit

Permalink
feat: add by discord added allowed locales
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulalaby committed Jan 17, 2024
1 parent 1ffb542 commit 042abe0
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ title: Translation Reference
## Command Object

| Key | Value | Description |
| ------------------------ | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| name | string | name of the application command |
| description? | string | description of the application command |
| type | int | [type](#application-command-type) of application command, used to map command types |
| name_translations | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command name |
| description_translations | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command description, only valid for slash commands |
| options | array of [Option Objects](#option-object) | array of option objects containing translations |
| Key | Value | Description |
| ------------------------- | --------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
| name | string | name of the application command |
| description? | string | description of the application command |
| type | int | [type](#application-command-type) of application command, used to map command types, not valid for options |
| name_translations | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command name |
| description_translations? | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command description, only valid for slash commands |
| options | array of [Option Objects](#option-object) | array of option objects containing translations |

### Application Command Type

Expand All @@ -29,21 +29,22 @@ title: Translation Reference

## Command Group Object

| Key | Value | Description |
| ------------------------ | --------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
| name | string | name of the application command group |
| description? | string | description of the application command group |
| name_translations | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command group name |
| description_translations | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command group description |
| commands | array of [Command Objects](#command-object) | array of command objects containing translations |
| groups | array of [Sub Command Group Objects](#sub-command-group-object) | array of sub command group objects containing translations |
| Key | Value | Description |
| ------------------------ | --------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |
| name | string | name of the application command group |
| description | string | description of the application command group |
| type | int | [type](#application-command-type) of application command, used to map command types, not valid for options |
| name_translations | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command group name |
| description_translations | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command group description |
| commands | array of [Command Objects](#command-object) | array of command objects containing translations |
| groups | array of [Sub Command Group Objects](#sub-command-group-object) | array of sub command group objects containing translations |

## Sub Command Group Object

| Key | Value | Description |
| ------------------------ | --------------------------------------------- | -------------------------------------------------------------------------------------- |
| name | string | name of the application command sub group |
| description? | string | description of the application command group |
| description | string | description of the application command sub group |
| name_translations | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command sub group name |
| description_translations | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command sub group description |
| commands | array of [Command Objects](#command-object) | array of command objects containing translations |
Expand All @@ -53,7 +54,7 @@ title: Translation Reference
| Key | Value | Description |
| ------------------------ | ------------------------------------------------------- | ----------------------------------------------------------------------------------- |
| name | string | name of the application command option |
| description? | string | description of the application command group |
| description | string | description of the application command group |
| name_translations | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command option name |
| description_translations | array of [Translation KVPs](#translation-kvp) | array of translation key-value-pairs for the application command option description |
| choices | array of [Option Choice Objects](#option-choice-object) | array of option choice objects containing translations |
Expand All @@ -80,35 +81,37 @@ A translation object is a key-value-pair of `"locale": "value"`.

## Valid Locales

| Locale | Language |
| ------ | --------------------- |
| da | Danish |
| de | German |
| en-GB | English, UK |
| en-US | English, US |
| es-ES | Spanish |
| fr | French |
| hr | Croatian |
| it | Italian |
| lt | Lithuanian |
| hu | Hungarian |
| nl | Dutch |
| no | Norwegian |
| pl | Polish |
| pt-BR | Portuguese, Brazilian |
| ro | Romanian, Romania |
| fi | Finnish |
| sv-SE | Swedish |
| vi | Vietnamese |
| tr | Turkish |
| cs | Czech |
| el | Greek |
| bg | Bulgarian |
| ru | Russian |
| uk | Ukrainian |
| hi | Hindi |
| th | Thai |
| zh-CN | Chinese, China |
| ja | Japanese |
| zh-TW | Chinese, Taiwan |
| ko | Korean |
| Locale | Language |
| ------ | ---------------------- |
| id | Indonesian |
| da | Danish |
| de | German |
| en-GB | English, UK |
| en-US | English, US |
| es-ES | Spanish |
| es-419 | Spanish, Latin America |
| fr | French |
| hr | Croatian |
| it | Italian |
| lt | Lithuanian |
| hu | Hungarian |
| nl | Dutch |
| no | Norwegian |
| pl | Polish |
| pt-BR | Portuguese, Brazilian |
| ro | Romanian, Romania |
| fi | Finnish |
| sv-SE | Swedish |
| vi | Vietnamese |
| tr | Turkish |
| cs | Czech |
| el | Greek |
| bg | Bulgarian |
| ru | Russian |
| uk | Ukrainian |
| hi | Hindi |
| th | Thai |
| zh-CN | Chinese, China |
| ja | Japanese |
| zh-TW | Chinese, Taiwan |
| ko | Korean |
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ A correct translation json for english and german would look like that:
{
"name": "my_command",
"description": "This is description of the command group.",
"type": 1,
"name_translations": {
"en-US": "my_command",
"de": "mein_befehl"
Expand All @@ -87,11 +88,11 @@ A correct translation json for english and german would look like that:
"en-US": "This is description of the command group.",
"de": "Das ist die description der Befehl Gruppe."
},
"groups": [],
"commands": [
{
"name": "first",
"description": "First",
"type": 1, // Type 1 for slash command
"name_translations": {
"en-US": "first",
"de": "erste"
Expand All @@ -104,7 +105,6 @@ A correct translation json for english and german would look like that:
{
"name": "second",
"description": "Second",
"type": 1, // Type 1 for slash command
"name_translations": {
"en-US": "second",
"de": "zweite"
Expand All @@ -117,6 +117,7 @@ A correct translation json for english and german would look like that:
{
"name": "value",
"description": "Some string value.",
"type": 3,
"name_translations": {
"en-US": "value",
"de": "wert"
Expand Down Expand Up @@ -182,7 +183,6 @@ A correct json for this example would look like that:
},
{
"name": "My Command",
"description": null,
"type": 2, // Type 2 for user context menu command
"name_translations": {
"en-US": "My Command",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public sealed class DiscordApplicationCommandLocalization
/// <summary>
/// Gets valid [locales](xref:modules_application_commands_translations_reference#valid-locales) for Discord.
/// </summary>
internal readonly List<string> ValidLocales = ["ru", "fi", "hr", "de", "hu", "sv-SE", "cs", "fr", "it", "en-GB", "pt-BR", "ja", "tr", "en-US", "es-ES", "uk", "hi", "th", "el", "no", "ro", "ko", "zh-TW", "vi", "zh-CN", "pl", "bg", "da", "nl", "lt"];
internal readonly List<string> ValidLocales = ["ru", "fi", "hr", "de", "hu", "sv-SE", "cs", "fr", "it", "en-GB", "pt-BR", "ja", "tr", "en-US", "es-ES", "uk", "hi", "th", "el", "no", "ro", "ko", "zh-TW", "vi", "zh-CN", "pl", "bg", "da", "nl", "lt", "id", "es-419"];

/// <summary>
/// Adds a localization.
Expand Down

0 comments on commit 042abe0

Please sign in to comment.