Skip to content

Conversation

@Lulalaby
Copy link
Member

@Lulalaby Lulalaby commented Dec 20, 2025

Translations Extension

Features translation support & management via webinterface

Details

UI

image image

Translations

DiscordUser user;
DiscordInteraction interaction;
interaction.T("translation.key", new { user = user.Mention });
{
  "translation.key": {
    "en-US": "Hello {user}",
    "de": "Hallo {user}"
}

Manager

using DisCatSharp.Extensions.Translations.Manager;

// ..
DiscordClient client;
CancellationToken token;
// ..

TranslationManager manager = new(client, new TranslationsManagerConfiguration() {});
_ = await manager.StartAsync(token);

Reports

{
  "GeneratedAt": "2025-12-21T00:09:08.8931953+00:00",
  "RepoRoot": "/path/to/root",
  "SourceDirectory": "/path/to/root/source",
  "StringsPath": "/path/to/root/source/data/translations/strings.json",
  "UsedKeysCount": 321,
  "DefinedKeysCount": 327,
  "MissingKeys": [],
  "UnusedKeys": [
    "test.duplicate",
    "test.unused"
  ],
  "DuplicateKeys": [],
  "DuplicateEnUsValues": {},
  "LocaleMissingCounts": {
    "en-US": 0,
    "de": 1
  },
  "DynamicKeyUsages": [
    {
      "File": "src\\Utilities.cs",
      "Line": 198,
      "Method": "TLocale",
      "Reason": "dynamic key",
      "Expression": "$\u0022contrib.{contribution.ActionType.ToString().ToLowerInvariant()}Action\u0022"
    },
    // ..
  ],
  "KeyUsages": {
    "master.currentlyGrinding": [
      {
        "Key": "master.currentlyGrinding",
        "File": "src\\Utilities.cs",
        "Line": 87,
        "Method": "TLocale"
      }
    ],
    // ..
  }
}

@Lulalaby Lulalaby force-pushed the feat/translations branch 5 times, most recently from fa9a2e3 to 1c537b0 Compare December 21, 2025 00:01
Introduced new Translations extensions for ApplicationCommands, CommandsNext, and Manager, including supporting project files and extension methods. Updated documentation to include API references and table of contents for the new extensions. Made minor copyright year updates and added 'dcs-artifacts/' to .gitignore.
@Lulalaby Lulalaby added documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed labels Dec 21, 2025
@Lulalaby Lulalaby self-assigned this Dec 21, 2025
@Lulalaby Lulalaby requested review from TheXorog and fthomys December 21, 2025 00:14
@Lulalaby Lulalaby changed the title feat: translations extension WIP - feat: translations extension Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed

Development

Successfully merging this pull request may close these issues.

3 participants