-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate and migrate strftime
formats
#1234
Comments
strftime
formats for PHP8.1+strftime
formats
It's even more complicated than expected. 😓 |
With #1238 I have now generalized the usage of Eventually the strftime may disappear but this requires more work. Also, I dislike the two QTX_DATE_OVERRIDE and QTX_STRFTIME_OVERRIDE settings. |
There is a "replacement" written in php: Original code: https://gist.github.com/bohwaz/42fc223031e2b2dd2585aab159a20f30 Original autor: BohwaZ |
Yes, you already mentioned it in #1085. It's been merged in #1228 with a few modifications needed for qTranslate-XT. However we should stop using |
There is really no analog for |
The strftime function is deprecated with PHP8.1.
We have now a substitution called
qxtranxf_intl_strftime
(based onIntlDateFormatter
working with PHP8.1) - see #1228. This change is mostly transparent for the users, allowing to use PHP8.1 already now and keep in principle the current strftime or date tags as before (default or by language). There is an advanced option called "Date / Time Conversion" to select the format, but no need to change... yet. It is supposed to work for both. However, there are many caveats.(A) The "strftime format" used in qTranslate has been extended to mimic some "date" formats.
For example:
%q
mimics dateS
for english day ordinal number (1st, 2nd, ...). That doesn't exist in strftime.A full list can be found here: #1085 (comment). Most of these "extended tags" fill some empty gaps so it's acceptable, but a few ones are overriding existing official strftime tags. That's not good and those won't be supported anymore in their qTranslate definition. They look quite specific so it should not be a big problem.
(B) The "date" format is not handled natively by qTranslate.
It is converted to this "extended strftime format" and then goes through a strftime call... But there are also some calls to date to deal with the "extended format"... so it's a terrible mess. Moreover, the basic date function does not care about locales so there are surely some limitations.
So, I suggest to abandon the strftime formats completely because it's such a mess to maintain. Here's the plan:
IntlDateFormatter
. It's different from the new strftime implementation, this doesn't exist yet.The text was updated successfully, but these errors were encountered: