The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Wrong display date ...
 
Share:
Notifications
Clear all

[Solved] Wrong display date format in french (maybe other languages as well?)

3 Posts
2 Users
0 Likes
713 Views
Posts: 2
Topic starter
(@scubadoo7800)
New Member
Joined: 4 years ago

Hi guys,

First of all thanks for this awesome plugin. I'm implementing it since yesterday but I'm really enjoying it already.

Anyway I would like to report a bug in the display date format.

On French websites the date isn't displayed in the right format (maybe same issue for sites running with other languages?)

In English we write "2 weeks ago" > this is OK.

But in french we cannot say "2 semaines il y a" > this is wrong. We should say "il y a 2 semaines".

So the translated phrase "wc_ago_text" must come before the date value.

I've found a workaround by updating 3 lines in the dateDiff function in file"utils/class.WpdiscuzHelper.php"

Line 100 :

-- Removed --      $text = "";

++ Added ++       $text = get_locale() == "fr_FR" ? esc_html($this->options->phrases["wc_ago_text"]) . " " : "";

Line 127 :

-- Removed --       $replace[] = esc_html($this->options->phrases["wc_ago_text"]);

++ Added ++        $replace[] = get_locale() == "fr_FR" ? "" : esc_html($this->options->phrases["wc_ago_text"]);

Line 128 :

-- Removed --       $text = str_replace($search, $replace, $this->options->general["dateDiffFormat"]);
++ Added ++        $text .= str_replace($search, $replace, $this->options->general["dateDiffFormat"]);

 

It does the job fine as of now but of course it will be scrapped at the next plugin update 🙁

Would it be possible to tackle this translation issue in one of the next plugin updates ?

Maybe by creating an "exception array" for all the languages where "wc_ago_text" must come upfront ?

Thanks for reading and keep up the good job !

Best regards,

Fabrice.

2 Replies
Posts: 36
(@taron)
Eminent Member
Joined: 5 years ago

Hi @scubadoo7800,

Please remove all the customizations you've made, then
navigate to Dashboard > wpDiscuz > Settings > General tab and find the "Structure of Human Readable Date Format" option. You can configure the date format with this option.

More information here:
https://wpdiscuz.com/docs/wpdiscuz-7/plugin-settings/general-settings/#structure-of-human-readable-date-format

1 Reply
(@scubadoo7800)
Joined: 4 years ago

New Member
Posts: 2

Hi @taron

Thanks for the swift answer !

Indeed it was really simple to solve... too much maybe 🙂

I didn't found it before and while browsing all the options... My apologizes for that.

Have a nice day 🙂

Share: