From 042abe042bf01564d1df7c56a7f5ff085ecbe16a Mon Sep 17 00:00:00 2001 From: Lala Sabathil Date: Wed, 17 Jan 2024 02:02:01 +0100 Subject: [PATCH] feat: add by discord added allowed locales --- .../translations/reference.md | 103 +++++++++--------- .../translations/using.md | 6 +- .../DiscordApplicationCommandLocalization.cs | 2 +- 3 files changed, 57 insertions(+), 54 deletions(-) diff --git a/DisCatSharp.Docs/articles/modules/application_commands/translations/reference.md b/DisCatSharp.Docs/articles/modules/application_commands/translations/reference.md index 91c08e74e..3e3add573 100644 --- a/DisCatSharp.Docs/articles/modules/application_commands/translations/reference.md +++ b/DisCatSharp.Docs/articles/modules/application_commands/translations/reference.md @@ -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 @@ -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 | @@ -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 | @@ -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 | diff --git a/DisCatSharp.Docs/articles/modules/application_commands/translations/using.md b/DisCatSharp.Docs/articles/modules/application_commands/translations/using.md index 08eae63f4..0c7bbfd1f 100644 --- a/DisCatSharp.Docs/articles/modules/application_commands/translations/using.md +++ b/DisCatSharp.Docs/articles/modules/application_commands/translations/using.md @@ -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" @@ -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" @@ -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" @@ -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" @@ -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", diff --git a/DisCatSharp/Entities/Application/DiscordApplicationCommandLocalization.cs b/DisCatSharp/Entities/Application/DiscordApplicationCommandLocalization.cs index c35213380..d5a557672 100644 --- a/DisCatSharp/Entities/Application/DiscordApplicationCommandLocalization.cs +++ b/DisCatSharp/Entities/Application/DiscordApplicationCommandLocalization.cs @@ -17,7 +17,7 @@ public sealed class DiscordApplicationCommandLocalization /// /// Gets valid [locales](xref:modules_application_commands_translations_reference#valid-locales) for Discord. /// - internal readonly List 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 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"]; /// /// Adds a localization.