Skip to content

Commit

Permalink
Fix issue #1110 (part 1)
Browse files Browse the repository at this point in the history
  • Loading branch information
mystralkk committed Jan 19, 2022
1 parent 544df21 commit 232d012
Show file tree
Hide file tree
Showing 6 changed files with 623 additions and 0 deletions.
39 changes: 39 additions & 0 deletions language/english.php
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,21 @@
12 => 'December'
);

$LANG_MONTH_SHORT = array(
1 => 'Jan',
2 => 'Feb',
3 => 'Mar',
4 => 'Apr',
5 => 'May',
6 => 'Jun',
7 => 'Jul',
8 => 'Aug',
9 => 'Sep',
10 => 'Oct',
11 => 'Nov',
12 => 'Decr'
);

###############################################################################
# Weekdays

Expand All @@ -2071,6 +2086,30 @@
7 => 'Saturday'
);

$LANG_WEEK_SHORT = array(
1 => 'Sun',
2 => 'Mon',
3 => 'Tue',
4 => 'Wed',
5 => 'Thu',
6 => 'Fri',
7 => 'Sat'
);

###############################################################################
# AM/PM

$LANG_AMPM = array(
'am_pm' => array(
'am' => 'am',
'pm' => 'pm',
),
'AM_PM' => array(
'am' => 'AM',
'pm' => 'PM',
),
);

###############################################################################
# Admin - Strings
#
Expand Down
39 changes: 39 additions & 0 deletions language/english_utf-8.php
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,21 @@
12 => 'December'
);

$LANG_MONTH_SHORT = array(
1 => 'Jan',
2 => 'Feb',
3 => 'Mar',
4 => 'Apr',
5 => 'May',
6 => 'Jun',
7 => 'Jul',
8 => 'Aug',
9 => 'Sep',
10 => 'Oct',
11 => 'Nov',
12 => 'Decr'
);

###############################################################################
# Weekdays

Expand All @@ -2071,6 +2086,30 @@
7 => 'Saturday'
);

$LANG_WEEK_SHORT = array(
1 => 'Sun',
2 => 'Mon',
3 => 'Tue',
4 => 'Wed',
5 => 'Thu',
6 => 'Fri',
7 => 'Sat'
);

###############################################################################
# AM/PM

$LANG_AMPM = array(
'am_pm' => array(
'am' => 'am',
'pm' => 'pm',
),
'AM_PM' => array(
'am' => 'AM',
'pm' => 'PM',
),
);

###############################################################################
# Admin - Strings
#
Expand Down
39 changes: 39 additions & 0 deletions language/japanese_utf-8.php
Original file line number Diff line number Diff line change
Expand Up @@ -2048,10 +2048,35 @@
12 => '12月'
);

$LANG_MONTH_SHORT = array(
1 => ' 1月',
2 => ' 2月',
3 => ' 3月',
4 => ' 4月',
5 => ' 5月',
6 => ' 6月',
7 => ' 7月',
8 => ' 8月',
9 => ' 9月',
10 => '10月',
11 => '11月',
12 => '12月'
);

###############################################################################
# Weekdays

$LANG_WEEK = array(
1 => '日曜日',
2 => '月曜日',
3 => '火曜日',
4 => '水曜日',
5 => '木曜日',
6 => '金曜日',
7 => '土曜日'
);

$LANG_WEEK_SHORT = array(
1 => '日',
2 => '月',
3 => '火',
Expand All @@ -2061,6 +2086,20 @@
7 => '土'
);

###############################################################################
# AM/PM

$LANG_AMPM = array(
'am_pm' => array(
'am' => 'am',
'pm' => 'pm',
),
'AM_PM' => array(
'am' => 'AM',
'pm' => 'PM',
),
);

###############################################################################
# Admin - Strings
#
Expand Down
35 changes: 35 additions & 0 deletions public_html/lib-common.php
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,10 @@
setlocale(LC_TIME, $_CONF['locale']);
}

$_LOCALE = new \Geeklog\Locale($LANG_MONTH, $LANG_MONTH_SHORT, $LANG_WEEK, $LANG_WEEK_SHORT, $LANG_AMPM);
$_LOCALE->setTimezone(TimeZoneConfig::getTimezone());
$_LOCALE->setLocale($LANG_ISO639_1);

// Override language items (since v2.1.2)
Language::init();
$language_overrides = array(
Expand Down Expand Up @@ -9279,6 +9283,37 @@ function COM_handleEval($code, $type = 1, $embeddedPHP = false)
return $retarray;
}

/**
* Format a GMT/UTC time/date according to locale settings
*
* @param string $format format string as in gmstrftime
* @param int|null $timestamp local timestamp, null = current timestamp
* @return false|string formatted date and time as GMT, false when $format is empty or contains
* unsupported conversion specifiers
* @note substitute function for gmstrftime.
*/
function COM_gmstrftime($format, $timestamp = null)
{
global $_LOCALE;

return $_LOCALE->strftime($format, $timestamp);
}
/**
* Format a local time/date according to locale settings
*
* @param string $format format string as in strftime
* @param int|null $timestamp local timestamp, null = current timestamp
* @return false|string formatted local date and time, false when $format is empty or contains
* unsupported conversion specifiers
* @note substitute function for strftime.
*/
function COM_strftime($format, $timestamp = null)
{
global $_LOCALE;

return $_LOCALE->strftime($format, $timestamp);
}

// Check and see if any plugins (or custom functions)
// have scheduled tasks to perform
if (!isset($_VARS['last_scheduled_run']) || !is_numeric($_VARS['last_scheduled_run'])) {
Expand Down

0 comments on commit 232d012

Please sign in to comment.