Please make sure to update to WPML 4.3.5 and check our list of Known Issues before reporting

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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 13 replies, has 3 voices.

Last updated by Silvia Tejera 9 months, 2 weeks ago.

Assigned support staff: Raja Mohammed.

Author Posts
February 21, 2019 at 3:37 pm

jean-paulS

Hi,
I have a bilingual site under construction in English (EN) and Dutch (NL)
The date format of the posts and the comments beneath the posts weren’t translated.
So I have put this code, that I found somewhere on the internet, in functions.php:

add_filter( 'option_date_format', function( $format ) {
do_action( 'wpml_register_single_string', 'Date formats', 'Date format', $format );
return apply_filters( 'wpml_translate_single_string', $format, 'Date Formats', 'Date format' );
} );
add_filter( 'option_time_format', function( $format ) {
do_action( 'wpml_register_single_string', 'Date formats', 'Time format', $format );
return apply_filters( 'wpml_translate_single_string', $format, 'Date Formats', 'Time format' );
} );

Then I translated the date format from F j, Y (EN) to j F Y (NL) in the string translation.
The date format in the comments was saved correctly, but not above the posts itself.
“2 Nov, 2015” should be “2 nov 2015”

Link to a page where the issue can be seen: hidden link (site under construction)

I expected to see: 2 nov 2015

Instead, I got:2 Nov, 2015

February 21, 2019 at 5:08 pm
February 22, 2019 at 11:23 am #3232027

Raja Mohammed
Supporter

Languages: English (English )

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

Hi there,

Since you are using DIVI the default date format can be changed from the DIVI theme options.

I have added the appropriate admin_text for the date format in string translation with the name "[et_divi]divi_date_format" Now you can translate the date format for all the active languages in your site.

I have already added a translation for testing purpose. Attached screenshot for further clarification.

I hope this solves your issue.

Kind regards
Raja

February 22, 2019 at 8:42 pm #3233954

jean-paulS

Hi,
Sorry to say, but the date formats are still not correct.
Above the Dutch posts (for example hidden link), the date is: “November 3 2015” where it should be “3 november 2015”.
And in the date format of the Dutch comments, there is now a comma between the month and the year, and the name of the month isn’t abbreviated anymore, which it was before and which I prefer. The comma wasn’t there when I used the code I mentioned in my question and also not after the intervention of your colleague Laura. Don’t know what she did precisely: there is a part of the chat transcription that is missing.
Also, the English date format isn’t correct anymore: both the date formats for the posts and for the comments are the Dutch ones now. Above the post it’s “3 November, 2015” and in the comments “on 5 December, 2018 at 08:35.” See hidden link
Changing the sequence in DIVI > theme options > general from j F, Y to F j, Y doesn’t solve the problem.
(I searched for other data format strings in the string translation, but now I can’t find “admin_texts_et_divi” or “[et_divi]divi_date_format” anymore.)

February 25, 2019 at 12:52 pm #3239768

Raja Mohammed
Supporter

Languages: English (English )

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

Hi,

I'm Unable to access the site can you please enable the access again I will look in the detail of missing "admin_texts_et_divi" since that is the only place where you can change the date format for each language and DIVI uses WordPress date formatting so you can refer the WordPress date format documentation https://codex.wordpress.org/Formatting_Date_and_Time and set the display based on the it.

I have enabled private fields to securely share the details.

Kind regards
Raja

February 25, 2019 at 1:23 pm
February 26, 2019 at 5:50 am #3243165

Raja Mohammed
Supporter

Languages: English (English )

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

Hi there,

Thanks for the update. I am able to access the site now and I can find the domains admin_texts_date_format (for comments) and admin_texts_et_divi (for posts) in string translation (screenshot attached).

Let me know if you need further assistance.

Kind regards
Raja

February 26, 2019 at 9:34 am #3243779

jean-paulS

Hi Raja,

1. The date formats are ok now for the posts and the comments in Dutch (NL). However, above the posts, the name of the month is capitalized which it shouldn't be (see screenshot). In the comments, the date is correct with lowercase for the month. I don't see a string character for the month in lowercase.
Is there a way to translate the name of the month above the posts correctly?

2. On the Dutch (NL) blog page (with the overview of the posts), the date format is not translated (Nov 3, 2015 instead of 3 nov 2015 - see screenshot).
How to translate these date formats?

Kind regards,
Jean-Paul

February 26, 2019 at 12:58 pm #3244882

Raja Mohammed
Supporter

Languages: English (English )

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

Hi Jean-paul,

1) Unfortunately, there is no date format which can show the lowercase month format.

2) Since you are using the Blog module you can manually adjust eh date format form the blog module settings. I have updated the format for the NL translation for you. For your reference, I have added the screenshot.

I hope this helps you better, Let me know if you need further assistance.

Kind regards
Raja

February 27, 2019 at 8:40 am #3248946

jean-paulS

Hi Raja,

First of all, thanks for the translation solution for the blog module.

You say that there is no data format which can show the lowercase month format, but in the comments, it does show the name of the month with a lowercase. How can it be that one date format (admin_texts_date_format) is translated right, and the other (admin_texts_et_divi) not ?
And how does someone with a website only in Dutch handle this? Most blog pages in Dutch are with the month in lowercase (see screenshots: Blog Page in Dutch of which I'm sure it's made with WordPress and post of that Blog).

So there must be a solution for this, no? (I searched the internet for a solution, but can't find one).

Kind regards,

Jean-Paul

February 27, 2019 at 11:21 am #3249772

Raja Mohammed
Supporter

Languages: English (English )

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

Hi Jean-paul,

The lowercase can be possible in two cases applying lowercase PHP function in code or through translation. However, I am not sure how it is handled in a DIVI theme.

The comment section displays the date from String translation, but it seems the post and blog module is not handling it as expected and applies the DIVI date format, Could you please check with DIVI support if they can provide some insight into this.

Let me know the results

Kind regards
Raja

February 28, 2019 at 7:41 am #3253895

jean-paulS

Hi Raja,

Elegant Themes support could solve the problem with this code in Custom CSS:

.post-meta .published {
text-transform: lowercase !important;
}
.et_post_meta_wrapper .post-meta {
text-transform: lowercase !important;
}
.et_post_meta_wrapper .post-meta a {
text-transform: capitalize !important;
}

So all the dates are ok now.
Thanks a lot for the support for the other date issues!

Kind regards,
Jean-Paul

February 28, 2019 at 7:47 am #3253941

Raja Mohammed
Supporter

Languages: English (English )

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

Hi Jean-Paul

Thanks for the update. The CSS solution skipped my mind. Glad to know your issue is resolved.
Please mark the thread as resolved and leave your valuable feedback.

Kind regards
Raja

February 28, 2019 at 8:57 am #3254231

jean-paulS

There was still a problem that I overlooked: with the code above, the names of the month in English were with underscore too. I managed to find the solution by adding “:lang(nl)” in the code. So the right code is:

.post-meta :lang(nl).published {
text-transform: lowercase !important;
}
.et_post_meta_wrapper :lang(nl).post-meta {
text-transform: lowercase !important;
}
.et_post_meta_wrapper :lang(nl).post-meta a {
text-transform: capitalize !important;
}

Kind regards, once again,
Jean-Paul

February 28, 2019 at 9:03 am #3254234

jean-paulS

My issue is resolved now. Thank you!