Skip Navigation

[Resolved] Post translation issue in my view

This thread is resolved. Here is a description of the problem and solution.

Problem:
Post translation issue in my view - display translated date on frontend

Solution:
To display the translated date on frontend, you should write a shortcode that should return the translated date value.

You can find the proposed solution in this case with the following reply:
=> https://toolset.com/forums/topic/post-translation-issue-in-my-view/#post-1995925

Relevant Documentation:
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/

This support ticket is created 3 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 3 replies, has 2 voices.

Last updated by dominiqueM-3 3 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1995143

Hello Toolset support team

Tell us what you are trying to do?
I would like to display the title, date and excerpt of posts in a view in french language.
My site is only in french language. It is not a multi-lingual site. There is not any translation plugin.
I would like to display date with month in plain text, eg: 21 mars 2021.
In general settings, language is set to French (Français).
I can't figure out how to output post date in french.

Is there any documentation that you are following?
https://toolset.com/forums/topic/a-custom-date-field-is-not-being-translated-properly-in-a-layout-and-view/

Is there a similar example that we can see?

What is the link to your site?
As you can see in this test site - hidden link - post dates are still in english.

Thank you

#1995679

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

It seems you need to localize the date in your desired format using the WordPress function: date_i18n().

And to do that we need to add custom shortcode.

If you can share temporary admin access details I'm happy to add that shortcode and share the solution with you.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1995925

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've added the following shortcode to "Custom Code" shortcode section:
=> hidden link

add_shortcode('wpv-show-date', 'func_display_locale_date' );	
function func_display_locale_date() {
	global $post;	
	return date_i18n ('d F Y',strtotime($post->post_date));		
}

And then within your archive's loop section, I've added the "Fields and Text" block and added the called the above shortcode as given under:

[wpv-show-date]

I can see now date is translated: hidden link

you should edit your archive and remove the single field block that displays the date in English.

#1995985

My issue is resolved now. Thank you!