Install-Package LibreTranslate.Net.Enhanced -Version 1.5.6
using LibreTranslate.Net;
var LibreTranslate = new LibreTranslate();
System.Collections.Generic.IEnumerable<SupportedLanguages> SupportedLanguages = await LibreTranslate.GetSupportedLanguagesAsync();
System.Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(supportedLanguages, Newtonsoft.Json.Formatting.Indented));
var englishText = "Hello World!";
string spanishText = await LibreTranslate.TranslateAsync(new Translate() {
ApiKey = "MySecretApiKey",
Source = LanguageCode.English,
Target = LanguageCode.Spanish,
Text = englishText
});
System.Console.WriteLine(spanishText);
Hello World!
¡Hola Mundo!
var LibreTranslate = new LibreTranslate("https://server_url");
Task<IEnumerable<SupportedLanguages>> GetSupportedLanguagesAsync();
Task<string> TranslateAsync(Translate translate);
Language | Code |
---|---|
English | LanguageCode.English |
Arabic | LanguageCode.Arabic |
Chinese | LanguageCode.Chinese |
French | LanguageCode.French |
German | LanguageCode.German |
Hindi | LanguageCode.Hindi |
Irish | LanguageCode.Irish |
Italian | LanguageCode.Italian |
Japanese | LanguageCode.Japanese |
Korean | LanguageCode.Korean |
Portuguese | LanguageCode.Portuguese |
Russian | LanguageCode.Russian |
Spanish | LanguageCode.Spanish |
AutoDetect | LanguageCode.AutoDetect //This feature is experimental |