Skip Navigation

Resolved

Reported for: Ninja Forms Multilingual 0.3.0

Resolved in: Ninja Forms Multilingual 0.3.1

Topic Tags: Compatibility

Overview of the issue

When using Ninja Forms and its Repeatable Fields 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

Please, be sure to make a full backup of your site before proceeding.

  1. Open …/wp-content/plugins/wpml-ninja-forms/classes/Hooks/NinjaForms/Strings.php file.
  2. Look for line 62.
  3. Replace this code:
    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 ) );
    }
    

    With:

    if (
    	$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 ) );
    	}
    }