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 ??