Skip Navigation

[Closed] how to make field label and content translatable in my functions file

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

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

This topic contains 5 replies, has 2 voices.

Last updated by Luo Yang 6 years, 2 months ago.

Assigned support staff: Luo Yang.


I want to make the label and content of the custom fields translatable. I have the fields set to translatable in the custom fields page in the WP backend. What do I need to do to this code in my functions.php file

add_action( 'woocommerce_before_single_product_summary', 'baba_spec', 30 );
function baba_spec() { 
	print '<div class="baba-specifications">';
	echo(types_render_field("designers", array('show_name' => 'true', 'output' => 'html')));
	echo(types_render_field("made", array('show_name' => 'true', 'output' => 'html')));
	echo(types_render_field("materials", array('show_name' => 'true', 'output' => 'html')));
	echo(types_render_field("baba-colors", array('show_name' => 'true', 'output' => 'html')));
	global $product;
	$dimensions = $product->get_dimensions();
 		if ( ! empty( $dimensions ) ) {
			print '<span class="wpcf-field-name">Dimensions: </span>'; 
			echo '<span class="dimensions">' . $dimensions . '</span>';
			print '</div>';

Luo Yang

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Are we talking about the string "Dimensions: " in the codes you mentioned above?
You can try wrap it with WordPress iin8 function, for example:
For example:

$label = __( 'Dimensions: ', 'mytextdomain' );
print '<span class="wpcf-field-name">' . $label . '</span>'; 

More help:


thanks for that!
Actually I was wondering how you handle making text within the types code translatable. Is it automatically? I am using show_name => 'true' to display the field name
I am using WPML. I can not figure out how to translate the name or the custom fields value in a woocommerce product


Luo Yang

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Yes, you can use WPML to translate the field labels and values, it is automatically.

See our document:
Multilingual Sites with Toolset Plugins
1.2 Custom fields in different languages

Hope it help


I have the custom fields content showing in WPML woocommerce for translation.
I can not see how to translate the field names which I am displaying

echo(types_render_field("designers", array('show_name' => 'true'..

The fields are set to translate in the custom fields page.
I go to WPML/Theme and plugins localization. Select Types. Scan for strings.
Then I go to WPML/String translation and do a search for 'designers' I get no result.


Luo Yang

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

I assume the custom fields (designers) is created with Types, Please try this:
1) Dashboard-> Types-> Custom Fields
Edit your custom field group,
click "Save" button, it will trigger WPML plugin register the Types settings of the custom field.
2) WPML-> String translation,
option "Select strings within context:" choose "plugin Types (x)",
You will be able to translate the string you need, see below demo site:
hidden link
user/pass: xgren/111111

The topic ‘[Closed] how to make field label and content translatable in my functions file’ is closed to new replies.