Yard DeepL
This plugin registers secure API endpoints that allow you to request translations directly from DeepL without exposing your DeepL API-key. These endpoints are only accessible when a valid nonce is provided. When providing translations to website visitors, you can configure which languages are suppor
This plugin registers secure API endpoints that allow you to request translations directly from DeepL without exposing your DeepL API-key. These endpoints are only accessible when a valid nonce is provided. When providing translations to website visitors, you can configure which languages are supported for translation.
Caching Mechanism
Each object that is translated will store its cached translation in the wp_postmeta table within the database. This caching mechanism ensures that translations are efficiently reused, reducing unnecessary API requests to DeepL and saving costs.
- Serving Cached Translations: If a cached translation is newer than the post_modified date of the object, the cached version is served.
- Fetching New Translations: When the post_modified date of the object is more recent than the cached translation, a new translation is fetched from DeepL. Once retrieved, this translation is immediately cached for future use.
- Cache Authorization: Only logged-in users with the edit_posts capability (or a custom capability configured via the yard::deepl/cache_capability filter) are permitted to create new cache entries. Requests from users without this capability will still return a translation from DeepL, but the result will not be stored in the cache.
This approach minimizes the number of API calls to DeepL, ensuring translations are kept up to date only when necessary.
Admin: Cache Metabox
A metabox labeled Yard DeepL is displayed on the edit screen of supported post types (default: page). It provides two options:
- Disable translation cache: When checked, the cache is bypassed for this object. Useful for posts with dynamic content that should always be translated fresh.
- Clear translation cache: When checked and the post is saved, all cached translations for this object are deleted.
Admin: Translation Cache Column
A Translation cache column is added to the post list screen of all supported post types. Its purpose is to notify editors which posts should be cached as soon as possible to avoid unnecessary DeepL API costs.
- Green badge per language (e.g. NL, EN-US): a valid, up-to-date cached translation exists for that language. Visitor requests are served from cache at no cost.