OpenTranslate-beta
1.0.0.9
dotnet add package OpenTranslate-beta --version 1.0.0.9
NuGet\Install-Package OpenTranslate-beta -Version 1.0.0.9
<PackageReference Include="OpenTranslate-beta" Version="1.0.0.9" />
paket add OpenTranslate-beta --version 1.0.0.9
#r "nuget: OpenTranslate-beta, 1.0.0.9"
// Install OpenTranslate-beta as a Cake Addin
#addin nuget:?package=OpenTranslate-beta&version=1.0.0.9
// Install OpenTranslate-beta as a Cake Tool
#tool nuget:?package=OpenTranslate-beta&version=1.0.0.9
OpenTranslate
OpenTranslate is an open-source translation engine that offers quality translations for various applications. It supports asynchronous usage, providing versatility for different use cases. OpenTranslate is a practical solution for those seeking reliable translations with a balance between performance and resource efficiency.
Optimizations
- Updated dependencies: We have added ExcelDataReader 3.6.0 and Microsoft.Office.Interop.Word 15.0.4797.1004 to improve document translations.
- Fixed JSON mismatch errors: We have fixed errors related to JSON serialization and deserialization, making the package more reliable and stable.
- Improved error handling: Improved our error handling to provide more informative feedback and recover smoothly from unexpected situations.
- Document translations: We added support for more document types and support for document translations, making OpenTranslate even more versatile.
- Added image translation as well.
Package Dependencies
Package | Version |
---|---|
Newtonsoft.Json | 13.0.3 |
IronOcr | 2023.4.13 |
IronOcr.MacOs | 2023.4.13 |
ExcelDataReader | 3.6.0 |
Microsoft.Office.Interop.Word | 15.0.4797.1004 |
Usage/Examples
GetTranslation(Sentence or Phrase, laguage from, language to);
Languages need to be specified in ISO 639-1 format like below:
using OpenTranslate;
var engine = new OpenTranslateClient();
string json = await engine.GetTranslation("Hello, May the force be with you.", "es");
Results results = JsonSerializer.Deserialize<Results>(json);
Console.Write("Your Translation: " + results.Translation + Environment.NewLine +
"Match Accuracy: " + results.MatchPercentage);
internal class Results
{
public string Translation { get; set; }
public string OriginText { get; set; }
public string MatchPercentage { get; set; }
public string LangFrom { get; set; }
public string LangTo { get; set; }
}
Get Document and Image Translations:
Languages need to be specified in ISO 639-1 format like below:
try
{
var engine = new OpenTranslateClient();
// Get PDF document translation
string pdfPath = "doc.pdf";
string isoLanguageFrom = "en";
string isoLanguageTo = "es";
string pdfResult = await engine.GetPDFDocumentTranslation(pdfPath, isoLanguageFrom, isoLanguageTo);
Results pdfTranslation = JsonSerializer.Deserialize<Results>(pdfResult);
Console.WriteLine("PDF Translation:");
Console.WriteLine($"Translation: {pdfTranslation.Translation}");
Console.WriteLine($"Match Accuracy: {pdfTranslation.MatchPercentage}");
Console.WriteLine();
// Get image translation
string imagePath = "image.png";
string imageResult = await engine.GetImageTranslation(imagePath, isoLanguageTo);
Results imageTranslation = JsonSerializer.Deserialize<Results>(imageResult);
Console.WriteLine("Image Translation:");
Console.WriteLine($"Translation: {imageTranslation.Translation}");
Console.WriteLine($"Match Accuracy: {imageTranslation.MatchPercentage}");
Console.WriteLine();
// Get word document translation
string docPath = "doc.docx";
isoLanguageFrom = "en";
isoLanguageTo = "fr";
string docResult = await engine.GetWordDocumentTranslation(docPath, isoLanguageFrom, isoLanguageTo);
Results docTranslation = JsonSerializer.Deserialize<Results>(docResult);
Console.WriteLine("Word Document Translation:");
Console.WriteLine($"Translation: {docTranslation.Translation}");
Console.WriteLine($"Match Accuracy: {docTranslation.MatchPercentage}");
Console.WriteLine();
// Get Excel translation
string excelPath = "excel.xlsx";
string excelResult = await engine.GetExcelTranslation(excelPath, isoLanguageTo);
Results excelTranslation = JsonSerializer.Deserialize<Results>(excelResult);
Console.WriteLine("Excel Translation:");
Console.WriteLine($"Translation: {excelTranslation.Translation}");
Console.WriteLine($"Match Accuracy: {excelTranslation.MatchPercentage}");
}
catch (Exception ex)
{
Console.WriteLine($"An error occurred: {ex.Message}");
}
internal class Results
{
public string Translation { get; set; }
public string OriginText { get; set; }
public string MatchPercentage { get; set; }
public string LangFrom { get; set; }
public string LangTo { get; set; }
}
Roadmap
- Continuously optimize code and performance for enhanced speed and reliability.
- Explore the possibility of integrating additional translation APIs for expanded language support.
- Remove all usage limits to ensure an unrestricted and fully open-source product.
- Expand documentation and provide additional code samples for easier implementation and usage.
License
Support
For support, email WebsiterzTech@gmail.com.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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 was computed. 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. |
-
net7.0
- ExcelDataReader (>= 3.6.0)
- IronOcr (>= 2023.4.13)
- IronOcr.MacOs (>= 2023.4.13)
- Microsoft.Office.Interop.Word (>= 15.0.4797.1004)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|
This is our 9th official beta release.
We have remove our previous limitations and are in the testing phase.
We have also added ocr document translations