MyBB Community Forums

Full Version: Developers can you read my suggestion ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

First I would like to thank you all for your fabulous work

Second I'm facing very huge and exhausting problem each time there is an upgrade , my forum is in arabic and I had to add small code to almost all php files to fix the time translation problem ( AM/PM )

e.g from index.php
$recordtime = my_date($mybb->settings['timeformat'], $mostonline['time']);
changed to
$recordtime = my_date($mybb->settings['timeformat'], $mostonline['time']);
$recordtime = preg_replace('/AM/', 'صباحاً', $recordtime);
$recordtime = preg_replace('/PM/', 'مساءاً', $recordtime);

Is it possible to make the AM/PM translatable in the language files ?
I mean to add or change the code so I don't have to do this with each upgrade


Thank you,
my_date uses the PHP date function to generate the dates, so it's a limitation that it cannot be translated by default.

However, you can make use of this plugin to make the translation each time my_date is called:
$plugins->run_hooks_by_ref("my_date", $date);
I believe imei developed a plugin to change this.

In order to fix this correctly you should make sure your PHP installation is set to the arabic language so you won't have to manually override it.
DennisTT Wrote:my_date uses the PHP date function to generate the dates, so it's a limitation that it cannot be translated by default.

Yes but can the following be true
( Actually I know nothing about coding so this my be totally wrong )

e.g
in global.lang.php add
$l['time_AM'] = "صباحاً";
$l['time_PM'] = "مساءاً";

Then add this code each time there is call for my_date
$recordtime = my_date($mybb->settings['timeformat'], $mostonline['time']);
$recordtime = preg_replace('/AM/', '{$lang->time_AM}', $recordtime);
$recordtime = preg_replace('/PM/', '{$lang->time_PM}', $recordtime); 

DennisTT Wrote:However, you can make use of this plugin to make the translation each time my_date is called:
$plugins->run_hooks_by_ref("my_date", $date);

As I said I know nothing about coding so can you please explain more !!


Tikitiki Wrote:I believe imei developed a plugin to change this.

Can you please direct me to this plugin


Thank you ALL
alnamer Wrote:
Tikitiki Wrote:I believe imei developed a plugin to change this.

Can you please direct me to this plugin


Thank you ALL

I believe it is hosted on an internationalization forum for MyBB or on his site. I unfortunately don't know the URL. And again, I may be wrong. You should try contacting imei himself