Zaya.Translator.Impl.Yandex
2.0.0
dotnet add package Zaya.Translator.Impl.Yandex --version 2.0.0
NuGet\Install-Package Zaya.Translator.Impl.Yandex -Version 2.0.0
<PackageReference Include="Zaya.Translator.Impl.Yandex" Version="2.0.0" />
<PackageVersion Include="Zaya.Translator.Impl.Yandex" Version="2.0.0" />
<PackageReference Include="Zaya.Translator.Impl.Yandex" />
paket add Zaya.Translator.Impl.Yandex --version 2.0.0
#r "nuget: Zaya.Translator.Impl.Yandex, 2.0.0"
#:package Zaya.Translator.Impl.Yandex@2.0.0
#addin nuget:?package=Zaya.Translator.Impl.Yandex&version=2.0.0
#tool nuget:?package=Zaya.Translator.Impl.Yandex&version=2.0.0
Zaya.Translator
Pluggable translation and translation-cache abstractions for the Zaya ecosystem — engines expose metadata and SettingDescriptors; hosts create translator sessions and optionally wrap them with a cache plugin.
Packages
| Package | Version | Role |
|---|---|---|
| Zaya.Translator | 2.0.0 | Abstractions: ITranslatorService, ITranslatorSession |
| Zaya.Translator.Impl.Google | 2.0.0.0 | Unofficial Google Translate (translate.googleapis.com) |
| Zaya.Translator.Impl.Yandex | 2.0.0.0 | Yandex Cloud API v2 and free browser endpoint |
| Zaya.TranslatorCache | 2.0.0 | Abstractions: ITranslatorCacheService |
| Zaya.TranslatorCache.Impl.Memory | 2.0.0.0 | In-memory exact + TTL cache |
Requires Zaya.Primitives 2.0.0. Plugin engines also use Zaya.Logging 1.0.0.
Update channels (GitHub Releases):
- Translator engines:
plugin-Zaya.Translator-v2.0-latest - Cache engine:
plugin-Zaya.TranslatorCache-v2.0-latest
See versioning and CHANGELOG.
Docs: API & articles
Features
- ITranslatorService — engine id, localized name/description,
Settings,CreateSessionAsync - ITranslatorSession —
TranslateAsync(string)/ batchTranslateAsync(IReadOnlyList<string>) - ITranslatorCacheService — wrap a raw session via
WrapSessionAsync(exact/TTL settings on Memory) - Failures surface as
LocalizedExceptionfor host UI - UI strings for engines/cache:
en,ru,zh-Hans,uk,de,pt,ja,ko,fr,tr,pl
There is no separate InitializeAsync: create a session with defaults or an explicit settings dictionary.
Installation
<PackageReference Include="Zaya.Translator" Version="2.0.0" />
<PackageReference Include="Zaya.Translator.Impl.Google" Version="2.0.0.0" />
<PackageReference Include="Zaya.Translator.Impl.Yandex" Version="2.0.0.0" />
<PackageReference Include="Zaya.TranslatorCache" Version="2.0.0" />
<PackageReference Include="Zaya.TranslatorCache.Impl.Memory" Version="2.0.0.0" />
Plugin zips for ScreenTranslator hosts (stable names) from the floating tags above:
Zaya.Translator.Impl.Google.zipZaya.Translator.Impl.Yandex.zipZaya.TranslatorCache.Impl.Memory.zip
Quick start (Google + Memory cache)
using Zaya.Translator.Impl.Google;
using Zaya.TranslatorCache.Impl.Memory;
using var translator = new GoogleTranslatorService();
using var cache = new MemoryTranslatorCacheService();
using var raw = await translator.CreateSessionAsync(new Dictionary<string, object>
{
["autoDetectLanguage"] = true,
["targetLanguage"] = "ru",
});
using var session = await cache.WrapSessionAsync(raw, new Dictionary<string, object>
{
["enableCache"] = true,
});
var text = await session.TranslateAsync("Hello, world!");
Console.WriteLine(text);
Or DI:
services.AddGoogleTranslator();
// services.AddYandexTranslator();
services.AddMemoryTranslatorCache();
Engine lifecycle
Resolve ITranslatorService (new / DI / Activator on entryPoint)
→ CreateSessionAsync(settings)
Resolve ITranslatorCacheService
→ WrapSessionAsync(rawSession, cacheSettings)
→ TranslateAsync(...)
→ Dispose session / services
Google / Yandex notes
- Both engines accept a hidden
userAgentsetting (default Chrome desktop UA) for HTTP requests. - Google batch mode wraps segments as
([…])when the text does not already contain those markers. - Yandex:
useApiKey= false → free browser endpoint (unofficial);useApiKey= true → Yandex Cloud Translate API v2. - Yandex exposes a single Chinese code (
zh); the UI shows one Chinese option (not Simplified/Traditional separately).
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.10)
- Zaya.Logging (>= 1.0.0)
- Zaya.Translator (>= 2.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.