Tilde.Translation
1.1.0.84
See the version list below for details.
dotnet add package Tilde.Translation --version 1.1.0.84
NuGet\Install-Package Tilde.Translation -Version 1.1.0.84
<PackageReference Include="Tilde.Translation" Version="1.1.0.84" />
paket add Tilde.Translation --version 1.1.0.84
#r "nuget: Tilde.Translation, 1.1.0.84"
// Install Tilde.Translation as a Cake Addin #addin nuget:?package=Tilde.Translation&version=1.1.0.84 // Install Tilde.Translation as a Cake Tool #tool nuget:?package=Tilde.Translation&version=1.1.0.84
Tilde translation .NET library
Tilde MT is a translation platform for instant, fluent, and secure text, document translation.
This .NET library provides a robust and user-friendly interface for integrating machine translation capabilities into your .NET applications. Powered by advanced neural machine translation models, it enables seamless translation of text between multiple languages.
Installation
Using the .NET Core command-line interface (CLI) tools:
dotnet add package Tilde.Translation
Using the NuGet Command Line Interface (CLI):
nuget install Tilde.Translation
Supported frameworks
- .NET Standard 2.0
- .NET 6.0
Usage
Initialize Translator using Access key (API key).
using Tilde.Translation;
using Tilde.Translation.Exceptions;
var apiKey = "00000000-0000-0000-0000-000000000000";
var translator = new Translator(apiKey);
When implementing this library in your application, please provide information about application where this library will be used. This is optional step, but recomended
var options = new TranslatorOptions()
{
AppInfo = new AppInfo()
{
AppName = "my-app",
AppVersion = "1.0.0",
}
};
var translator = new Translator(apiKey, options);
Translating text
var translation = await translator.TranslateTextAsync("First sentence", "en", "lv");
Console.WriteLine(translation.DetectedLanguage); // null | "en" | ...
Console.WriteLine(translation.Domain); // "finance"
Console.WriteLine(translation.Translations[0].Translation); // "Pirmais teikums"
Translating documents
// Specify file to translate
var sourceDocument = new FileInfo(@"./Document/ExampleDocument.txt");
// Start document translation
var documentHandle = await translator.TranslateDocumentAsync(sourceDocument, "en", "lv");
// Wait for document translation to finish
var documentStatus = await translator.TranslateDocumentWaitUntilDoneAsync(documentHandle);
Console.WriteLine(documentStatus.Status); // Completed
Console.WriteLine(documentStatus.Substatus); // Unspecified
// Save file
var fileStream = File.Create(@"./Document/ExampleDocumentResult.txt");
await translator.TranslateDocumentResultAsync(documentHandle, fileStream);
fileStream.Close();
Get available engines
var engines = await translator.GetEnginesAsync();
Console.WriteLine(engines.First().SourceLanguages.First()); // "en"
Console.WriteLine(engines.First().TargetLanguages.First()); // "lv"
Error handling
All errors are derived from TildeException
base exception. To catch errors use TildeException
or derived specific exceptions.
try
{
var translation = await translator.TranslateTextAsync("First sentence", "en", "lv");
Console.WriteLine(translation.DetectedLanguage);
Console.WriteLine(translation.Domain);
Console.WriteLine(translation.Translations[0].Translation);
}
catch (TildeException ex)
{
Console.WriteLine(ex.Message);
}
Contributing
We welcome contributions from the community! If you encounter issues, have suggestions, or want to add new features, please submit a pull request or open an issue on the GitHub repository.
License
This library is licensed under the MIT License, allowing flexibility for both personal and commercial use.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 is compatible. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 is compatible. net481 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.6.2
- Microsoft.Extensions.Http.Polly (>= 8.0.7)
- System.Text.Json (>= 8.0.4)
-
.NETFramework 4.7.2
- Microsoft.Extensions.Http.Polly (>= 8.0.7)
- System.Text.Json (>= 8.0.4)
-
.NETFramework 4.8
- Microsoft.Extensions.Http.Polly (>= 8.0.7)
- System.Text.Json (>= 8.0.4)
-
.NETFramework 4.8.1
- Microsoft.Extensions.Http.Polly (>= 8.0.7)
- System.Text.Json (>= 8.0.4)
-
.NETStandard 2.0
- Microsoft.Extensions.Http.Polly (>= 8.0.7)
- System.Text.Json (>= 8.0.4)
-
.NETStandard 2.1
- Microsoft.Extensions.Http.Polly (>= 8.0.7)
- System.Text.Json (>= 8.0.4)
-
net6.0
- Microsoft.Extensions.Http.Polly (>= 8.0.7)
- System.Text.Json (>= 8.0.4)
-
net7.0
- Microsoft.Extensions.Http.Polly (>= 8.0.7)
- System.Text.Json (>= 8.0.4)
-
net8.0
- Microsoft.Extensions.Http.Polly (>= 8.0.7)
- System.Text.Json (>= 8.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.