Home › Forums › General Issues › Translating form field labels in frontend with Polylang
Hello! I found this post just now. I am looking to get in strings to Polylang from ACF and I cant understand why this is not default thing. I have checkboxes and radio buttons value and have many languages on the site. How can I get these into Polylang string translation? Help files tells me I must have 1 group per language. This is so unpoorly done when having lots of content. Any help in getting in all the fields to poly?
I know I’m a bit too late in this! But please I need your help..!
I’m trying to display ACF in front-end using:
1.Elementor PRO
2.ACF (free verstion)
3. CPT Plugin
4. Polylang Free (2 Languages)
I applied this bit of code found in previous thread:
function polylang_translate()
{
pll_register_string('back', 'back','General');
pll_register_string('main_bedroom', 'Main Bedroom','General');
pll_register_string('villa_size', 'Villa Size','General');
pll_register_string('no_of_people', 'No of People','General');
pll_register_string('bedrooms', 'Bedrooms','General');
pll_register_string('bathrooms', 'Bathoom','General');
pll_register_string('wc', 'W.C','General');
}
add_action( 'init', 'polylang_translate' );
..which displays the fields to be translated in Polylang’s back-end no problem. However, I don’t see the translated fields in front-end, neither within ELementor’s Dynamic field tags, (which is what I’m using to display the custom fields), or anywhere.
I also added code displayed in this thread by Mark Howells-Mead in my functions.php, but I don’t see anything different happening.
Can I make this work and have the fields translated and displayed somehow in the front-end?
I don’t have much knowledge in coming up with my own code, nor have I used current set up with above plugin combo to achieve this.
Any advice / help will be much appreciated 🙂
Thank you
Hello Marc,
Thank you for the snippet. I have tried to edit it to allow the translation of the $fields['choices']
and can’t manage to make it work.
I also saw in your WPLM implementation that you added new fields (instructions etc), do you know if it is possible to translate the choices too?
Now, I’m using add_filter('acf/load_field/name=field_name', function($field)
but it is not working when editing the post in the admin area as the post language is not picked up (and the get_locale()
is not useful).
Thanks
The topic ‘Translating form field labels in frontend with Polylang’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.