Gravity Forms
-
Any support/planned support for Gravity Forms? Would the manually translated fields (
[:en][:]
syntax) still work?
-
I plan this. But in paid version. It is currently in development.
Would the manually translated fields (
[:en][:]
syntax) still work?Yes. It is base syntax for WP Multilang.
Cool, thanks a lot. I’m considering switching from
qtranslate-x
before it breaks the site on an update.Use test server before.
That’s the plan.
I’ve been playing around with the plugin on a test server amd, after ironing out a few problems with migration, it doesn’t seem to work with gravity forms at all.
See this screenshot: https://goo.gl/vWU6xV
None of the (manually) translated fields get switched.
You need add filters before displaying strings. If it possible in Gravity Form.
I wrote the following function:
function translate_gravity_forms( $form ) { $form['title'] = wpm_translate_string($form['title']); if ($form['description']) { $form['description'] = wpm_translate_string($form['description']); } foreach( $form['fields'] as &$field ) { $field['label'] = wpm_translate_string($field['label']); if ($field['description']) { $field['description'] = wpm_translate_string($field['description']); } if ($field['content']) { $field['content'] = wpm_translate_string($field['content']); } if ($field['choices']) { foreach( $field['choices'] as &$choice ) { $choice['text'] = wpm_translate_string($choice['text']); } } } return $form; } add_filter( 'gform_pre_render', 'translate_gravity_forms' );
And the fields still don’t get translated. Am I using the wrong function? which one should I use?
This is getting more complicated than it needs to be 😐
Any info on this?
To anyone concerned
I’ve found the correct way to translate gravity fields:
function translate_gravity_forms( $form ) { $form['title'] = wpm_translate_string($form['title']); if ($form['description']) { $form['description'] = wpm_translate_string($form['description']); } foreach( $form['fields'] as &$field ) { $field->label = wpm_translate_string($field->label); if ($field->description) { $field->description = wpm_translate_string($field->description); } if ($field->content) { $field->content = wpm_translate_string($field->content); } if ($field->choices) { foreach( $field->choices as &$choice ) { $choice['text'] = wpm_translate_string($choice['text']); } } } return $form; } add_filter( 'gform_pre_render', 'translate_gravity_forms' );
References:
Form Object Source
Field Object SourceI do not give my consent to include this in a paid version of this plugin, but it’s ok to include it in the free version or as a standalone plugin (with attribution).
- This reply was modified 6 years, 2 months ago by reddo.
- The topic ‘Gravity Forms’ is closed to new replies.