Zaya.TranslatorCache 2.0.0

dotnet add package Zaya.TranslatorCache --version 2.0.0
                    
NuGet\Install-Package Zaya.TranslatorCache -Version 2.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Zaya.TranslatorCache" Version="2.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Zaya.TranslatorCache" Version="2.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Zaya.TranslatorCache" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Zaya.TranslatorCache --version 2.0.0
                    
#r "nuget: Zaya.TranslatorCache, 2.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Zaya.TranslatorCache@2.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Zaya.TranslatorCache&version=2.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Zaya.TranslatorCache&version=2.0.0
                    
Install as a Cake Tool

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):

See versioning and CHANGELOG.

Docs: API & articles

Features

  • ITranslatorService — engine id, localized name/description, Settings, CreateSessionAsync
  • ITranslatorSessionTranslateAsync(string) / batch TranslateAsync(IReadOnlyList<string>)
  • ITranslatorCacheService — wrap a raw session via WrapSessionAsync (exact/TTL settings on Memory)
  • Failures surface as LocalizedException for 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.zip
  • Zaya.Translator.Impl.Yandex.zip
  • Zaya.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 userAgent setting (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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Zaya.TranslatorCache:

Package Downloads
Zaya.TranslatorCache.Impl.Memory

In-memory translation cache for Zaya.TranslatorCache (exact + optional TTL).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.0.0 103 8/19/2026
1.1.0 113 8/14/2026
1.0.0 181 8/1/2026