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 1 reply, has 2 voices.

Last updated by Shekhar Bhandari 1 year ago.

Assigned support staff: Shekhar Bhandari.

Author Posts
October 10, 2018 at 1:09 pm #2804366

lucaS-37

I am trying to:

Display dynamic expected delivery dates on each product page.

I've got everything working, the php is inserted in the right place on each product page and the dates are updated dynamically, e.g. 'Delivery between 15 October and 16 October' is showing under the product price.

I'm using

	$start_text = __('Delivery between ','woodmart');
	$end_text = __(' and ','woodmart');

such that these strings can be translated using WPML String Translation.

I'm not sure however how I can translate the months to e.g. Dutch – Oktober and not October.

My code is the following,


	function my_custom_action() { 

		$plus3 = strtotime("+3 weekday");
		$plus4 = strtotime("+4 weekday");	
		$date_low = date('d F', $plus3);
		$date_high = date('d F', $plus4);
		$start_text = __('Delivery between ','woodmart');
		$end_text = __(' and ','woodmart');
		echo $start_text, $date_low, $end_text, $date_high;
	};     
	add_action( 'woocommerce_single_product_summary', 'my_custom_action', 15 );
October 11, 2018 at 8:21 am #2807161

Shekhar Bhandari
Supporter

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Thank you for contacting WPML support. I'd be happy to assist you further on this issue.

Hi there,

Thank you for contacting WPML support.

WordPress already includes the localized date formats. Please make sure that the WP .mo file is correctly installed in /wp-content/languages.

You can check this in WPML - Themes and Plugins localization
- Go to WPML -> themes and plugins localization.
- Enable "Translate themes and plugins using WPML's String Translation and always load .mo files as the backup" option.

If still the problem is not solved, could you please change your theme to default theme and check if the problem exists.

Reference site: http://codex.wordpress.org/Function_Reference/date_i18n

Look forward to your reply.

Thanks