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.

Our next available supporter will start replying to tickets in about 2.11 hours from now. Thank you for your understanding.

This topic contains 2 replies, has 2 voices.

Last updated by adriO 7 months, 1 week ago.

Assigned support staff: Laura.

Author Posts
March 13, 2019 at 10:48 am #3332179


This time I want to bring to your attention a very complicated issue. At least in my opinion. I trust you cracks will solve it easily.

In the site, I’m developing I will try to sell digital photos.
Every photo must have a license type to make clear how the photo may be used.

There are three license types:

The license types are coming from the image metadata.

These license types are shown on the single product page so the customer knows what license type is applicable.

For each license type, there is a short text about what the license means.
Commercial: This image may be used in commercial productions
Editorial: Only editorial use is allowed
Right managed: Use of this image is restricted by license and or property agreement. For more details please contact: <photographer name>

(See the front-end screenshot)

Those clarifying texts are hardcoded in a custom plugin. All translatable coded.

I have created a custom field, type select (with a dropdown menu) with the options (you can guess it) Commercial, Editorial and Rights-managed. I use this code for it:

woocommerce_wp_select( array( // Text Field type
    'id'                  => '_license_type',
    'label'               => __( 'License type', 'trusted_pro_child' ),
    'description'         => __( 'Select the license type here', 'trusted_pro_child' ),
    'desc_tip'            => true,
    'options'             => array(
        ''                => __( 'Select license type', 'trusted_pro_child' ),
        'Commercial'      => __('Commercial', 'trusted_pro_child' ),
        'Editorial'       => __('Editorial', 'trusted_pro_child' ),
        'Rights managed'  => __('Rights managed', 'trusted_pro_child' ),

) );

First thing I noticed is that I’m not able to translate the Options in String translation (even not when I scan the theme for strings. How come?)

Next: I want to treat those license types in the way tags are managed, once known don’t bother to display it in the product translation screen (WooCommerce Multilingual) because it is already known.

I try to set the custom field to translatable and that went ok (in a way).
However: I have to translate the license type for every Photo separately and I had to hard code the translations in my plugin.

I want to achieve that :
I only set the license type which will display the license type and the clarifying text in the right language accordingly.
I do not want to translate the license type for every product added or updated in the interface of WooCommerce Multilingual

Want more info? Just ask.
Sadly I am not able to give you access to my development site because it is on my local machine.

March 14, 2019 at 8:49 am #3341547


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

Timezone: Europe/Rome (GMT+02:00)


thanks for contacting us.

I see you are using PODS plugin, the code you wrote is in some way related to this plugin or is all custom code? Could you replicate the issue here? hidden link

March 14, 2019 at 1:07 pm #3344773


My issue is resolved now. Thank you!
It turned out I just made a mistake to set the custom field (see my code above) to translatable.
I changed it to <copy> and all is working well.