Home » HTML » HTML_QuickForm2 » Bug #5558
Use setlocale to determine language
Details
| Request #5558 | Use setlocale to determine language |
|---|---|
| Submitted | 2005-09-29 12:01 UTC |
| From | themars at users dot sourceforge dot net |
| Assigned | avb |
| Status | Closed |
| Package | HTML_QuickForm2 |
| PHP Version | Irrelevant |
| OS | Irrelevant |
| Roadmaps | 0.6.0 |
Comments
[2005-09-29 12:01 UTC] themars at users dot sourceforge dot net
Description:
------------
The HTML_QuickForm_Date element ignores the locale set by
setlocale(LC_TIME, $myLocale);
Why don't you use that locale if the language property is not explicitly set?
If you use the strftime function instead of the date function in the setValue method, you can support it.
Test script:
---------------
Change the default of the language property to "default":
line 72
line 267
Change the line (425):
$arr = explode('-', date('w-d-n-Y-h-H-i-s-a-A-W', (int)$value));
into:
if ($this->_options['language'] == 'default') {
$arr = explode('-', strftime('%w-%d-%m-%Y-%I-%H-%M-%S-%p-%p-%V', (int)$value));
$arr[2] = preg_replace('#^0#', '', $arr[2]);
$arr[9] = strtoupper($arr[9]);
} else {
$arr = explode('-', date('w-d-n-Y-h-H-i-s-a-A-W', (int)$value));
}
Expected result:
----------------
if the user does not specify a language, the language specified with setlocale or otherwise the system default language is used. If specified and found, the class behaves as before.
Actual result:
--------------
The language set by setlocale is ignored.