{"id":209850,"date":"2025-01-07T18:17:26","date_gmt":"2025-01-07T18:17:26","guid":{"rendered":"https:\/\/nl.wordpress.org\/plugins\/yard-deepl\/"},"modified":"2025-01-31T08:43:03","modified_gmt":"2025-01-31T08:43:03","slug":"yard-deepl","status":"publish","type":"plugin","link":"https:\/\/test.wordpress.org\/plugins\/yard-deepl\/","author":23069227,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.1.0","stable_tag":"1.1.0","tested":"6.7.5","requires":"6.0","requires_php":"8.0","requires_plugins":null,"header_name":"Yard DeepL","header_author":"Yard | Digital Agency","header_description":"This plugin registers secure API endpoints that allow you to request translations directly from DeepL without exposing your Deepl API-key","assets_banners_color":"","last_updated":"2025-01-31 08:43:03","external_support_url":"","external_repository_url":"","donate_link":"","header_plugin_uri":"","header_author_uri":"https:\/\/www.yard.nl","rating":0,"author_block_rating":0,"active_installs":20,"downloads":991,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":{"1.0.1":{"tag":"1.0.1","author":"yarddigitalagency","date":"2025-01-08 06:21:35"},"1.0.2":{"tag":"1.0.2","author":"yarddigitalagency","date":"2025-01-08 07:43:02"},"1.1.0":{"tag":"1.1.0","author":"yarddigitalagency","date":"2025-01-31 08:43:03"}},"upgrade_notice":[],"ratings":[],"assets_icons":{"icon-128x128.png":{"filename":"icon-128x128.png","revision":3218515,"resolution":"128x128","location":"assets","locale":""}},"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":["1.0.1","1.0.2","1.1.0"],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[180485,125,44319],"plugin_category":[54],"plugin_contributors":[236581,230332],"plugin_business_model":[],"class_list":["post-209850","plugin","type-plugin","status-publish","hentry","plugin_tags-deepl","plugin_tags-secure","plugin_tags-translating","plugin_category-security-and-spam-protection","plugin_contributors-mvdhoek1","plugin_contributors-yarddigitalagency","plugin_committers-yarddigitalagency"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/ps.w.org\/yard-deepl\/assets\/icon-128x128.png?rev=3218515","icon_2x":false,"generated":false},"screenshots":[],"raw_content":"<!--section=description-->\n<p>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.<\/p>\n\n<h3>Caching Mechanism<\/h3>\n\n<p>Each object that is translated will store its cached translation in the <code>wp_postmeta<\/code> table within the database. This caching mechanism ensures that translations are efficiently reused, reducing unnecessary API requests to DeepL and saving costs.<\/p>\n\n<ul>\n<li>Serving Cached Translations: If a cached translation is newer than the <code>post_modified<\/code> date of the object, the cached version is served.<\/li>\n<li>Fetching New Translations: When the <code>post_modified<\/code> 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.<\/li>\n<\/ul>\n\n<p>This approach minimizes the number of API calls to DeepL, ensuring translations are kept up to date only when necessary.<\/p>\n\n<h3>External Services<\/h3>\n\n<p>This plugin connects to the DeepL API to provide translations for content.<\/p>\n\n<ul>\n<li><strong>Service:<\/strong> DeepL API (https:\/\/www.deepl.com)<\/li>\n<li><strong>Purpose:<\/strong> To translate text from one language to another based on the provided target language.<\/li>\n<li><strong>Data Sent:<\/strong> Text content for translation, the target language code, and the DeepL API key (handled securely and never exposed to users).<\/li>\n<li><strong>Conditions:<\/strong> Data is sent when a request for translation is initiated.<\/li>\n<li><strong>Privacy Policy:<\/strong> <a href=\"https:\/\/www.deepl.com\/privacy\">DeepL Privacy Policy<\/a><\/li>\n<li><strong>Terms of Service:<\/strong> <a href=\"https:\/\/www.deepl.com\/pro-license\">DeepL Terms of Service<\/a><\/li>\n<\/ul>\n\n<h3>Usage<\/h3>\n\n<h3>Security<\/h3>\n\n<p>The API endpoints registered by this plugin are secured using a WordPress nonce. The nonce is passed to the front-end using the <code>wp_localize_script<\/code> function and is stored in a global JavaScript object <code>ydpl<\/code> which contains the following properties:<\/p>\n\n<ul>\n<li><code>ydpl_translate_post_id<\/code>: The ID of the post to be translated.<\/li>\n<li><code>ydpl_rest_translate_url<\/code>: The URL of the API endpoint for translation requests.<\/li>\n<li><code>ydpl_supported_languages<\/code>: The list of languages supported for translation.<\/li>\n<li><code>ydpl_api_request_nonce<\/code>: The nonce used for API validation.<\/li>\n<\/ul>\n\n<p>When making requests to the API, ensure that the nonce is included in the request headers. The header should be named <code>nonce<\/code>, and it should contain the value of <code>ydpl_api_request_nonce<\/code>.<\/p>\n\n<h3>Example<\/h3>\n\n<h3>Request<\/h3>\n\n<pre><code>var xhr = new XMLHttpRequest();\nxhr.open('POST', ydpl.ydpl_rest_translate_url, true);\n\n\/\/ Set request headers\nxhr.setRequestHeader('Content-Type', 'application\/json');\nxhr.setRequestHeader('nonce', ydpl.ydpl_api_request_nonce);\n\n\/\/ Handle response\nxhr.onreadystatechange = function () {\n    if (xhr.readyState === 4 &amp;&amp; xhr.status === 200) {\n        console.log('Translation:', JSON.parse(xhr.responseText));\n    } else if (xhr.readyState === 4) {\n        console.error('Error:', xhr.statusText);\n    }\n};\n\n\/\/ Prepare and send the request body\nvar data = JSON.stringify({\n    text: [\"Look another test\"],\n    target_lang: \"DE\"\n});\n\nxhr.send(data);\n<\/code><\/pre>\n\n<h3>Response<\/h3>\n\n<pre><code>[\n    {\n        \"text\": \"Look another test!\",\n        \"translation\": \"Sehen Sie sich einen weiteren Test an!\"\n    }\n]\n<\/code><\/pre>\n\n<!--section=installation-->\n<ol>\n<li>Upload plugin directory to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>1.1.0: Jan 31, 2025<\/h4>\n\n<ul>\n<li>Add: disable DeepL translation cache metabox<\/li>\n<li>Change: use init hook in plugin bootstrap construct, fixes translations for WordPress 6.7<\/li>\n<\/ul>\n\n<h4>1.0.2: Jan 08, 2025<\/h4>\n\n<ul>\n<li>Change: update all occurrences of 'deepl' to 'DeepL' for consistency<\/li>\n<\/ul>\n\n<h4>1.0.1: Jan 07, 2025<\/h4>\n\n<ul>\n<li>Change: processed corrections<\/li>\n<\/ul>\n\n<h4>1.0.0: Oct 18, 2024<\/h4>\n\n<ul>\n<li>Init: first release!<\/li>\n<\/ul>","raw_excerpt":"This plugin registers secure API endpoints that allow you to request translations directly from DeepL without exposing your DeepL API-key.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/test.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/209850","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/test.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/test.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/test.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=209850"}],"author":[{"embeddable":true,"href":"https:\/\/test.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/yarddigitalagency"}],"wp:attachment":[{"href":"https:\/\/test.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=209850"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/test.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=209850"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/test.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=209850"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/test.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=209850"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/test.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=209850"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/test.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=209850"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}