Date strings to be in correct language
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
In Progress
|
High
|
Doris Tam |
Bug Description
Display the dates in correct language
If we have a multi tenancy site then the PHP language may not be set to the one a person is viewing the site with so that PHP created strings, like a date may be in wrong language, eg
EN 24 July 2022, 08:37
DE 24. July 2022, 08:37
We can't use the PHP setlocale() function because it can cause issues on a multithreaded server
Now that we are including PHP intl module by default we can use some of it's functions to get what we need,
eg:
$cl = current_language();
// Remove the '.utf8' from the language
$cl = preg_replace(
$langobject = datefmt_create($cl, IntlDateFormatt
$langstring = datefmt_
log_
Changed in mahara: | |
status: | New → Confirmed |
importance: | Undecided → High |
milestone: | none → 22.10.0 |
description: | updated |
tags: | added: bite-sized |
description: | updated |
Changed in mahara: | |
milestone: | 22.10.0 → 23.04.0 |
We will need to create language string that follow the ICU date formats https:/ /unicode- org.github. io/icu/ userguide/ format_ parse/datetime/
They don't seem to have as many options that DateTime does but they do translate months / day words correctly