lecode-official / deepl-dotnet

A unofficial, fully-featured .NET client for the DeepL translation service.
MIT License
24 stars 13 forks source link
csharp deepl dotnet dotnet-core translation

DeepL.NET

DeepL.NET Logo

License: MIT Nuget Package Nuget Downloads

:warning: DEPRECATION NOTICE For some time now, an official .NET binding for DeepL has been available. This unofficial .NET binding has only been created, because, at the time, there was no official .NET binding. Therefore, this .NET binding has been deprecated. This means that this project will no longer receiver feature updates, security updates or bug fixes, and will not accept any community contributions. Also, the DeepLClient class was made obsolete and a compiler warning will be issued, when you use it. The repository has been put into archived mode and the accompanying NuGet package has been deprecated. To help you with the transition to the official DeepL.NET package, please refer to the migration guide

An unofficial, fully-featured .NET client for the DeepL translation service. DeepL is a commercial translation service based on deep learning. This API client only supports v2 of the API as v1 has been deprecated for new DeepL API plans available from October 2018.

Features

Getting Started

To get started you have to add the package reference to your project:

Install-Package DeepL -Version 0.4.3 # Package Manager
dotnet add package DeepL --version 0.4.3 # .NET CLI
paket add DeepL --version 0.4.3 # Paket CLI

or manually add a reference to your project file:

<PackageReference Include="DeepL" Version="0.4.3" />

Then you can start translating texts:

using DeepL;

namespace Application
{
    public class Program
    {
        public static async Task Main(string[] arguments)
        {
            using (DeepLClient client = new DeepLClient("<authentication key>", useFreeApi: false))
            {
                try
                {
                    Translation translation = await client.TranslateAsync(
                        "This is a test sentence.",
                        Language.German
                    );
                    Console.WriteLine(translation.DetectedSourceLanguage);
                    Console.WriteLine(translation.Text);
                }
                catch (DeepLException exception)
                {
                    Console.WriteLine($"An error occurred: {exception.Message}");
                }
            }
        }
    }
}

For a more complex example, please refer to the sample application, which is a fully-featured command line tool that demonstrates the usage of all DeepL.NET features. For a complete overview of DeepL.NET, please refer to the documentation.

Developing

If you want to develop the project further, please install the .NET Core SDK and, if necessary, Git. After that you are ready to clone the repository and build the project:

git clone https://github.com/lecode-official/deepl-dotnet.git
cd deepl-dotnet
dotnet build

Contributing

If you'd like to contribute, there are multiple ways you can help out. If you find a bug or have a feature request, please feel free to open an issue on GitHub. If you want to contribute code, please fork the repository and use a feature branch. Pull requests are always welcome. Before forking, please open an issue where you describe what you want to do. This helps to align your ideas with mine and may prevent you from doing work, that I am already planning on doing. If you have contributed to the project, please add yourself to the contributors list (CONTRIBUTORS.md). Also, if necessary, update the documentation and the DeepL CLI. To help speed up the merging of your pull request, please comment and document your code extensively and try to emulate the coding style of the project.

Releasing the NuGet Package

Before a releasing a new version to NuGet, do the following things:

License

The code in this project is licensed under MIT license. For more information see the license file.