Comment section not using Site Language
-
This may be a btter question in the Loco Translate forum:
https://ww.wp.xz.cn/support/plugin/loco-translate/You could try this:
add_filter( 'comment_form_default_fields', 'tu_filter_comment_fields', 20 ); function tu_filter_comment_fields( $fields ) { $commenter = wp_get_current_commenter(); $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; $fields['cookies'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' . '<label for="wp-comment-cookies-consent">TEXT FOR CHECKBOX HERE</label></p>'; return $fields; }Thank you for your reply corrinarusso.
1) Why should this be in the Loco Translate forum? The translations come from WordPress. I just used Loco Translate to confirm that all the strings were indeed translated. Everything else from in the Icelandic translation seems to work.
2) The code to change the comment-form-cookies-consent label works. I was just hoping it would be able to translate this bit without changing code.
Best regards,
Siggi> Why should this be in the Loco Translate forum?
It’s a suggestion, since there is a specific audience in that group who likely have experience in resolving the same problem for themselves.
> The code to change the comment-form-cookies-consent label works
Good. If you keep the filter in the functions file of your child theme, then you don’t need to worry about it being over-written when updates are released.
> I was just hoping it would be able to translate this bit without changing code
Personally, I would still deem this approach as configuration instead of customization – you are not changing code; since it lives outside the plugin, and lives outside the core.
But, it’s your call – I don’t know how else to do it without adding more time to limited value. Just my 2 cents.It’s a suggestion, since there is a specific audience in that group who likely have experience in resolving the same problem for themselves.
Yeah. It is a good idea. I will try posting there. Thank you for your help 🙂 .
The topic ‘Comment section not using Site Language’ is closed to new replies.
(@siggi_holm)
5 years ago
The problem
Most comment related elements are in English although the Site language is set to Icelandic.
Example 1:
Try to comment without inserting name or email.
Using Loco translate I can confirm that all strings are already fully translated. They just don’t show up in Icelandic on the site.
Example 2:
The string: „Save my name, email, and website in this browser for the next time I comment.“ should be in Icelandic.
This string is not shown in the WordPress language file. Where can I change it?
See this test site.
The page I need help with: [log in to see the link]