{"id":14537770,"date":"2021-06-09T15:38:21","date_gmt":"2021-06-09T15:38:21","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/field-validation-translations\/"},"modified":"2021-06-09T15:49:56","modified_gmt":"2021-06-09T15:49:56","slug":"field-validation-translations","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/field-validation-translations\/","title":{"rendered":"Field Validation Translations"},"content":{"rendered":"<p>Hello,<\/p>\n<p>I&#8217;m looking into an issue with the reCaptcha v2 for Contact Form 7 plugin. We&#8217;re using the following filter hook to provide validation for the reCaptcha: <code>wpcf7_validate_recaptcha<\/code>. We&#8217;re realizing that translations don&#8217;t seem to catch on here. For example, we have:<\/p>\n<pre><code>$result-&gt;invalidate(\n\t$tag,\n\tesc_html__( &#039;Please verify that you are not a robot.&#039;, &#039;wpcf7-recaptcha&#039; )\n);<\/code><\/pre>\n<p>We can see translations are provided in <a href=\"https:\/\/translate.wordpress.org\/projects\/wp-plugins\/wpcf7-recaptcha\/stable\/es-ve\/default\/?page=2\" rel=\"noopener\" target=\"_blank\">Spanish (Venezuela)<\/a> but when translations from that language are provided, these validation messages don&#8217;t seem to be translated. Everything else besides these validation messages get translated as expected.<\/p>\n<p>Also, if I error log the text in an early hook such as <code>template_redirect<\/code>, I get the translated text as expected. Maybe it has something to do with being dynamically pulled?<\/p>\n<pre><code>add_action( &#039;template_redirect&#039;, function() {\n\t\n\t\/\/ Logs &quot;Por favor, verifica que no eres un robot.&quot; as expected.\n\terror_log( esc_html__( &#039;Please verify that you are not a robot.&#039;, &#039;wpcf7-recaptcha&#039; ) );\n\t\n} );<\/code><\/pre>\n<p>Do you have any insight into why these strings are not being translated? Have you run into any similar issues with the validation hooks not providing translations? Should we not provide <code>wpcf7_validate_<\/code> with pre-translated strings or provide them these strings in a different way?<\/p>\n<p>Thank you for any suggestions or thoughts you may have!<\/p>\n","protected":false},"template":"","class_list":["post-14537770","topic","type-topic","status-publish","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/14537770","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/14537770\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=14537770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}