Overview of the Issue
When using Ninja Forms and its Repeatable Fields (opens in a new tab) feature, you may encounter an issue with translations. Although the fields can be translated using WPML String Translation, the translations of the subfields get overwritten when translating the parent repeater field label.
Workaround
This issue is fixed in Ninja Forms Multilingual 0.3.1. Updating solves it on your site, so you only need this workaround if you can’t update yet.
Please, be sure to make a full backup of your site before proceeding.
- Open …/wp-content/plugins/wpml-ninja-forms/classes/Hooks/NinjaForms/Strings.php file.
- Look for line 62.
- Replace this code:
With:PHP
if ( $this->getFormId() && $this->notEmpty( 'settings', $field ) && $this->notEmpty( 'type', $field['settings'] ) && $this->isTranslatableFieldType( $field['settings']['type'] ) ) { $field['settings'] = $this->getPackage()->translateField( $field['settings'], $this->getId( $field ) ); }
PHPif ( $this->getFormId() && $this->notEmpty( 'settings', $field ) && $this->notEmpty( 'type', $field['settings'] ) && $this->isTranslatableFieldType( $field['settings']['type'] ) ) { if (! array_key_exists('repeaterField', $field['settings'] ) && $field['settings']['repeaterField'] != true ) { $field['settings'] = $this->getPackage()->translateField( $field['settings'], $this->getId( $field ) ); } }