We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a simple test docker image built with the following compose file:
services: libretranslate: container_name: libretranslate image: libretranslate/libretranslate:latest restart: unless-stopped ports: - "5000:5000" command: --api-keys --disable-web-ui --req-limit 0 environment: - LT_API_KEYS_DB_PATH=/app/db/api_keys.db # Same result as db/api_keys.db or ./db/api_keys.db volumes: - libretranslate_api_keys:/app/db/api_keys.db
db/api_keys.db
./db/api_keys.db
volumes: libretranslate_api_keys:
In my .NET project I have added the nuget ref to LibreTranslate.Net and added using LibreTranslate.Net;
Then added the following code to call translate:
var libreTranslate = new LibreTranslate.Net.LibreTranslate("http://localhost:5000"); var englishText = "Hello World!"; var getSupportedLanguagesAsyncTask = libreTranslate.GetSupportedLanguagesAsync(); System.Threading.Tasks.Task.Run(() => getSupportedLanguagesAsyncTask).Wait(); var supportedLanguages = getSupportedLanguagesAsyncTask.Result; Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(supportedLanguages, Newtonsoft.Json.Formatting.Indented)); var TranslateAsyncTask = libreTranslate.TranslateAsync(new Translate() { ApiKey = "MySecretApiKey", Source = LanguageCode.English, Target = LanguageCode.Spanish, Text = englishText });
var spanishText = TranslateAsyncTask.Result; always returns null, am I missing some steps?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have a simple test docker image built with the following compose file:
services:
libretranslate:
container_name: libretranslate
image: libretranslate/libretranslate:latest
restart: unless-stopped
ports:
- "5000:5000"
command: --api-keys --disable-web-ui --req-limit 0
environment:
- LT_API_KEYS_DB_PATH=/app/db/api_keys.db # Same result as
db/api_keys.db
or./db/api_keys.db
volumes:
- libretranslate_api_keys:/app/db/api_keys.db
volumes:
libretranslate_api_keys:
In my .NET project I have added the nuget ref to LibreTranslate.Net and added using LibreTranslate.Net;
Then added the following code to call translate:
var libreTranslate = new LibreTranslate.Net.LibreTranslate("http://localhost:5000");
var englishText = "Hello World!";
var getSupportedLanguagesAsyncTask = libreTranslate.GetSupportedLanguagesAsync();
System.Threading.Tasks.Task.Run(() => getSupportedLanguagesAsyncTask).Wait();
var supportedLanguages = getSupportedLanguagesAsyncTask.Result;
Console.WriteLine(Newtonsoft.Json.JsonConvert.SerializeObject(supportedLanguages, Newtonsoft.Json.Formatting.Indented));
var TranslateAsyncTask = libreTranslate.TranslateAsync(new Translate()
{
ApiKey = "MySecretApiKey",
Source = LanguageCode.English,
Target = LanguageCode.Spanish,
Text = englishText
});
var spanishText = TranslateAsyncTask.Result; always returns null, am I missing some steps?
The text was updated successfully, but these errors were encountered: