Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Implemented Translator for LibreTranslate#739

Merged
tom-englert merged 8 commits into
dotnet:masterfrom
sven-n:LibreTranslate
Jan 27, 2026
Merged

Implemented Translator for LibreTranslate#739
tom-englert merged 8 commits into
dotnet:masterfrom
sven-n:LibreTranslate

Conversation

@sven-n

@sven-n sven-n commented Jan 25, 2026

Copy link
Copy Markdown
Contributor

I recently discovered LibreTranslate and thought it would be great to support it.
LibreTranslate can be run on your own computer and has an API.

See also:

@sven-n

sven-n commented Jan 25, 2026

Copy link
Copy Markdown
Contributor Author

@dotnet-policy-service agree

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements a new translator for LibreTranslate, a free and open-source machine translation API that can be self-hosted. The implementation adds support for translating resources using either a local LibreTranslate instance or a remote one, with optional API key authentication.

Changes:

  • Added LibreTranslateTranslator class following the established translator patterns in the codebase
  • Included comprehensive unit and integration tests for the new translator
  • Added XAML configuration files for UI integration

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/ResXManager.Translators/LibreTranslateTranslator.cs Core translator implementation with API integration, request/response models, and translation logic
src/ResXManager.Translators/LibreTranslateTranslatorConfiguration.xaml UI configuration view (minimal, as no additional configuration is needed beyond credentials)
src/ResXManager.Translators/LibreTranslateTranslatorConfiguration.xaml.cs Code-behind for configuration UI
src/ResXManager.Tests/Model/LibreTranslateTranslatorTests.cs Comprehensive test suite including unit tests for response parsing and optional integration tests
src/ResXManager.Tests/Model/TranslatorTests.cs Minor formatting adjustments to existing test strings (unrelated to LibreTranslate implementation)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ResXManager.Translators/LibreTranslateTranslator.cs
Comment thread src/ResXManager.Tests/Model/TranslatorTests.cs Outdated
Comment thread src/ResXManager.Tests/Model/TranslatorTests.cs Outdated
Comment thread src/ResXManager.Tests/Model/TranslatorTests.cs Outdated
The API offers the function to provide alternative translations, so it would make sense to offer this to the user as well.
Comment thread src/ResXManager.Translators/LibreTranslateTranslatorConfiguration.xaml Outdated
/// <summary>
/// The default URI of the LibreTranslate instance.
/// </summary>
private static readonly Uri _uri = new("http://localhost:5000/");

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The URL passed to the base class in the constructor is not the API url, but the link to the home page of the translator showing the instructions how to use it

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this case I would point it to the GitHub repo

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay, I'll change it :)

@sven-n sven-n requested a review from tom-englert January 26, 2026 18:13
@tom-englert tom-englert merged commit 8f03136 into dotnet:master Jan 27, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants