This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 15 replies, has 2 voices.

Last updated by Marcos Vinicios Barreto 5 months, 4 weeks ago.

Assigned support staff: Marcos Vinicios Barreto.

Author Posts
April 4, 2019 at 7:17 pm #3537881

ryanS-16

I am trying to: add custom-fields to wpml-config

<wpml-config>
    <custom-fields>
        <custom-field action="translate" style="line" label="Toggle More Text">toggle_more</custom-field>
        <custom-field action="translate" style="line" label="Toggle More Less">toggle_less</custom-field>
        <custom-field action="translate" style="line" label="Label">label</custom-field>
        <custom-field action="translate" style="textarea" label="Excerpt Content">excerpt_content</custom-field>
        <custom-field action="translate" style="textarea" label="Full Content">full_content</custom-field>
        <custom-field action="translate" style="line" label="Text">text</custom-field>
        <custom-field action="translate" style="line" label="Link">link</custom-field>
        <custom-field action="translate" style="textarea" label="Lightbox Content">lightbox_content_html</custom-field>
        <custom-field action="translate" style="line" label="Video Link">lightbox_video_link</custom-field>
        <custom-field action="translate" style="line" label="Title">title</custom-field>
        <custom-field action="translate" style="line" label="Title Quantification">title_quantify</custom-field>
        <custom-field action="translate" style="line" label="Sub-Title">sub_title</custom-field>
        <custom-field action="translate" style="textarea" label="Description">description</custom-field>
    </custom-fields>
</wpml-config>

Link to a page where the issue can be seen: WPML > Multilingual Content Setup > Custom Fields

I expected to see: The fields specified in wpml-config

Instead, I got: nothing

April 4, 2019 at 7:48 pm #3538229

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for contacting WPML Support. Can you please, provide me with some more details regarding what do you need to achieve? Where are you going to use these custom fields? Are they defined in your theme code or some third party plugin? Thank you for your clarifications, have a nice day.

April 4, 2019 at 8:00 pm #3538253

ryanS-16

Hi Marcos,
These are fields in some custom Beaver Builder modules that aren't getting picked up by WPML when editing a page. Here is some of the code for one of the modules: https://pastebin.com/vxczqSVD

April 5, 2019 at 3:11 pm #3545303

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates. I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Our Debugging Procedures

I will be checking various settings in the backend to see if the issue can be resolved. Although I won't be making changes that affect the live site, it is still good practice to backup the site before providing us access. In the event that we do need to debug the site further, I will duplicate the site and work in a separate, local development environment to avoid affecting the live site.

Privacy and Security Policy

We have strict policies regarding privacy and access to your information. Please see:
https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

**IMPORTANT**

- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields. If you do not, please ask me to enable the private box. The private box looks like this: hidden link

Please, let me know if you need any additional details. Have a nice day.

April 9, 2019 at 1:51 am #3561937

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates and sorry for the bit of waiting due the weekend. I took a detailed look in your WordPress Dashboard and unfortunately I am still not able to provide you with a solution, as you are dealing with custom Beaver Builder modules chances are they are not WPML ready as other module packages do such as https://wpml.org/plugin/ultimate-addon-for-beaver-builder/ and https://wpml.org/plugin/powerpack-for-beaver-builder/

This is why I need to get some more details from my colleagues in order to provide you with detailed instructions on how to make your custom modules fully compatible with WPML. Thank you for your continued patience and understanding. Have a nice day.

April 9, 2019 at 7:56 pm #3570461

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for your continued patience. While still don't have a full article on how to make custom Beaver Builder modules ready for translation, you can follow the instructions of this ticket: https://wpml.org/forums/topic/translating-custom-modules-for-beaver-builder/ to get it working.

Also, it follows some concepts found here: https://wpml.org/documentation/plugins-compatibility/elementor/how-to-add-wpml-support-to-custom-elementor-widgets/. You can also take a look in the provide compatible modules from my previous reply. Hope it helps, have a nice day.

April 9, 2019 at 9:22 pm #3570909

ryanS-16

Thank you Marcos,
I don't quite understand the example:

https://wpml.org/documentation/plugins-compatibility/elementor/how-to-add-wpml-support-to-custom-elementor-widgets/#translation-of-more-complicated-widgets

for the integration-class. (the example has a syntax error by the way. Line 6 should be removed).

The part that I don't understand is the code block showing the `interface IWPML_Page_Builders_Module`. Is there a full example that shows a full class that also `implements` the interface. I very much do not understand the parameters passed to the get and update functions.

April 10, 2019 at 5:33 pm #3579457

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates. I just provided the elementor instructions (https://wpml.org/documentation/plugins-compatibility/elementor/how-to-add-wpml-support-to-custom-elementor-widgets/#translation-of-more-complicated-widgets) to highlight the concepts.

You should use the specific code sample of this ticket: https://wpml.org/forums/topic/translating-custom-modules-for-beaver-builder/ as reference to make your custom modules translatable.

You can also take a look at other WPML ready module packages such as https://wpml.org/plugin/ultimate-addon-for-beaver-builder/ and https://wpml.org/plugin/powerpack-for-beaver-builder/ in order to learn more on how to proceed.

Please, let me know if it helps, have a nice day.

April 11, 2019 at 8:51 pm #3592899

ryanS-16

Thanks Marcos,
Sorry, but the answers and links you provided: you have already provided them to me - I'm asking for clarification in those links in my earlier message. I'm not sure how I can be more specific. But in the first link the 'fields' element is defined with an array of values but in the 2nd link the 'fields' element is set to an empty string with with the addition of specify a 'integration-class'. Which method are we supposed to use? For the interface I has asked for what the parameters mean as well.

Additionally, in the ticket you're citing, https://wpml.org/forums/topic/translating-custom-modules-for-beaver-builder/ , Ahmed is saying to use this:

apply_filters( 'wpml_beaver_builder_modules_to_translate', $this->nodes_to_translate );

yet he doesn't use it in his example later on in the conversation. Instead he is using

add_filter( 'wpml_beaver_builder_modules_to_translate', array( $this, 'wpml_modules_to_translate_filter' ) );

Are we to use apply_filters? or add_filter?

April 12, 2019 at 2:42 pm #3599991

ryanS-16

I've commented out the translation-class and have entered the fields directly in the wpml_modules_to_translate_filter function but it still doesn't appear as a field in the translation.

https://pastebin.com/ufj0XDXP

It seems that the strings we're having problems with are in the `FLBuilder::register_settings_form('pricing_form', array(` code block

Whereas in the ticket you linked, the fields in the register_module are being translated. Does that make a difference?

April 12, 2019 at 6:44 pm #3601263

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates. Although we aren't able to help you with custom modules implementation, I will try to bring some more clarifications for you on how to get your module ready for translation:

1 - You should use the 'add_filter' call in the constructor method of your class, in this case it would be:

add_filter( 'wpml_beaver_builder_modules_to_translate', array( $this, 'wpml_modules_to_translate_filter' ) );

2 - I am not familiar with Beaver Builder custom modules, this way I kindly ask you to refer to their docs on how to get your custom modules properly created and registered, this is the general structure based in the provided ticket sample above:

class MyCustomModule extends FLBuilderModule {

public function __construct() {

    // Modules initializations here
    parent::__construct(array()); 
    
    // Here we pass the wpml_modules_to_translate_filter to the actual wpml filter
    add_filter( 'wpml_beaver_builder_modules_to_translate', array( $this, 
                    'wpml_modules_to_translate_filter' ) ); 

}

public function wpml_modules_to_translate_filter( $modules ) {
    $modules[ 'module-slug' ] = array();
}

}

// Module registration
FLBuilder::register_module('MyModuleClass', module_paramenters);

The structure above is based in the customer custom module provided the ticket from my previous reply available at: https://pastebin.com/UL9h7KMm. Below is the full implementation with the module ready for translation:

<?php
   
class feduHeroImage extends FLBuilderModule {
   
    public function __construct() {
        parent::__construct(array(
            'name'            => __( 'Hero Image', 'fl-builder' ),
            'description'     => __( 'Top of page hero image with title', 'fl-builder' ),
            'category'        => __( 'General', 'fl-builder' ),
            'dir'             => FEDU_BB_MODULES_DIR . 'fedu-hero-image/',
            'url'             => FEDU_BB_MODULES_URL . 'fedu-hero-image/',
            'editor_export'   => true, // Defaults to true and can be omitted.
            'enabled'         => true, // Defaults to true and can be omitted.
            'partial_refresh' => false, // Defaults to false and can be omitted.
        ));
        add_filter( 'wpml_beaver_builder_modules_to_translate', array( $this, 'wpml_modules_to_translate_filter' ) );
   }
   public function wpml_modules_to_translate_filter( $modules ) {
        $modules[ 'fedu-hero-image' ] = [
            'conditions' => [ 'type' => 'fedu-hero-image' ],
            'fields'     => [
                [
                    'field'       => 'headline',
                    'type'        => __( 'Optional headline for the hero image', 'fl-builder' ),
                    'editor_type' => 'LINE'
                ],
            ],
        ];
  
        return $modules;
    }
}

   
   
   
FLBuilder::register_module( 'feduHeroImage', array(
    'tab-1' => array(
        'title'     => __( 'General', 'fl-builder' ),
        'sections'  => array(
            'section-1' => array(
                'title'     => __( 'Data', 'fl-builder' ),
                'fields'    => array(
                    'image'  => array(
                        'type'      => 'photo',
                        'label'     => __( 'Image', 'fl-builder' ),
                        'help'          => __( 'Select an image to be displayed.', 'fl-builder' )
                    ),
                    'headline' => array(
                        'type'          => 'text',
                        'label'         => __( 'Headline', 'fl-builder' ),
                        'description'   => __( 'Optional headline for the hero image', 'fl-builder' ),
                    )
                )
            )
        )
    )
) );

See:
hidden link

Please, let me know if it helps, otherwise I will forward your ticket to our second level support in order to get a more accurate and detailed reply. Have a nice day.

April 12, 2019 at 7:06 pm #3601373

ryanS-16

Thanks Marcos,
The problem is that we have fields in a form that aren't being translated. Any fields we have defined using FLBuilder::register_settings_form do not get picked up for string translations.

	public function wpml_modules_to_translate_filter( $modules ) {
		$modules[ 'mpl-pricing' ] = [
			'conditions' => [ 'type' => 'mpl-pricing' ],
			'fields' => [
				[
					'field' => 'title',
					'type' => __('Title', 'fl-buildler'),
					'editor_type' => 'LINE'
				],
				[
					'field' => 'title_quantify',
					'type' => __('Title Quantification', 'fl-buildler'),
					'editor_type' => 'LINE'
				],
				[
					'field' => 'sub_title',
					'type' => __('Sub-Title', 'fl-buildler'),
					'editor_type' => 'LINE'
				],
				[
					'field' => 'description',
					'type' => __('Description', 'fl-buildler'),
					'editor_type' => 'LINE'
				],
			]
		];

		return $modules;
	}

}

FLBuilder::register_module('MPLPricingModule', array(
	'general'       => array(
		'title'         => __( 'General', 'fl-builder' ),
		'sections'      => array(
			'general'       => array(
				'title'         => '',
				'fields'        => array(
					'pricing' => array(
						'type'          => 'form',
						'label'         => __('Pricing', 'fl-builder'),
						'form'          => 'pricing_form',
						'preview_text'  => 'text',
						'multiple'      => true,
					),
				),
			),
			'display'       => array(
				'title'         => __( 'Display', 'fl-builder' ),
				'fields'        => array(
					'layout'          => array(
						'type'          => 'select',
						'label'         => __( 'Layout', 'fl-builder' ),
						'default'       => 'horizontal',
						'options'       => array(
							'horizontal'   => __( 'Horizontal', 'fl-builder' ),
							'verticle'     => __( 'Vertical', 'fl-builder' ),
						),
					),
					'icon_position'   => array(
						'type'          => 'select',
						'label'         => __( 'Icon Position', 'fl-builder' ),
						'default'       => 'above',
						'options'       => array(
							'above'        => __( 'Above Content', 'fl-builder' ),
							'beside'        => __( 'Beside Content', 'fl-builder' ),
						),
					),
				),
			),
		),
	),
));



FLBuilder::register_settings_form('pricing_form', array(
	'title' => __('Price', 'fl-builder'),
	'tabs'  => array(
		'general'      => array(
			'title'         => __('General', 'fl-builder'),
			'sections'      => array(
				'general'       => array(
					'title'         => 'Button',
					'fields'        => array(
						'title'         => array(
							'type'          => 'text',
							'label'         => __( 'Title', 'fl-builder' ),
						),
						'title_quantify' => array(
							'type'          => 'text',
							'label'         => __( 'Title Quantification', 'fl-builder' ),
						),
						'sub_title'      => array(
							'type'          => 'text',
							'label'         => __( 'Sub-Title', 'fl-builder' ),
						),
						'description' => array(
							'type'          => 'textarea',
							'label'         => __( 'Description', 'fl-builder' ),
							'rows'          => '3'
						),
						'icon'          => array(
							'type'          => 'photo',
							'label'         => __( 'Icon', 'fl-builder' ),
							'show_remove'   => true,
							'help'          => __( 'Upload SVG icons or PNGs @2x the size you would like them to appear', 'fl-builder' ),
						),
					)
				),
			),
		),
	),
));
April 15, 2019 at 8:45 pm #3616365

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates. I forwarded your ticket to our second level support. I will update you here as soon as I have some more details from them. Thank you for your understandin and patience. Have a nice day.

April 18, 2019 at 5:07 pm #3641025

ryanS-16

Any progress on this?

April 18, 2019 at 6:04 pm #3641379

Marcos Vinicios Barreto
Supporter

Languages: English (English ) Portuguese (Brazil) (Português )

Timezone: America/Bahia (GMT-03:00)

Hello,

Thank you for the updates and sorry for the bit of waiting here. I've sent your request to our developers as the second level support wasn't able to provide the full details. I will update you here as soon as we got some more details from them. Thank you for your continued patience and understanding. Have a nice day.

The topic ‘[Closed] Custom XML custom-fields are not being added to Custom Field Translations’ is closed to new replies.