Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [RFC] Calendars support?
Offline
Re: [RFC] Calendars support?
gaekwad wrote #331266:
Is there anything helpful we can glean from core.trac.wordpress.org/changeset/51587 ?
Nope, we are in advance.
Offline
Re: [RFC] Calendars support?
Bloke wrote #331258:
Love is in the air (provided php intl extension is enabled):
<txp:posted calendar="japanese" format="%c" />
Offline
Re: [RFC] Calendars support?
etc wrote #331275:
Love is in the air (provided php
intlextension is enabled):
<txp:posted calendar="japanese" format="%c" />…
that sounds … lovely :-)
p.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: [RFC] Calendars support?
An issue with localised date (Japanese).
In the following, the date (<txp:posted />) for the article is September 5, 2020, date output based on the selected format in Preferences when not overridden. The spaces between Y/M/D in the manual examples are added for readability here in the forum.
–^–^–
I am not sure if this an error on my side or a weakness somewhere (Textpattern? PHP?).
Input: <txp:posted />, output: 5 September 2020.
Localised – Input: <txp:posted lang="jpn" />, output 5 9月 20. Expected: 5日 9月 20. PHP (or Textpattern ?) automagically adds the 月 (month) but not 日 (day).
If I manually build the date, with format='%Y %b %e', output is 2020 9月 5 . Again, expected 5日.
Then, adding the calendar attribute, short form:
Input:<txp:posted calendar=‘japanese’ format=’%x’ lang=‘jpn’ />, output: R2/9/5. Technically this is correct, 2020 is equivalent to Reiwa 2 (current era name). However “Reiwa” could be localised (令和). If I use the longer form, same <txp:posted /> as above, with addition of the calendar attribute, I get 2 9月 5, no era indication.
The same problem happens with the public side set to use Japanese.
The missing 日 character is certainly not new. That happens with previous versions Textpattern as well. It shouldn’t be very difficult for me to manually add the era name in my long-form examples, or the “day” character. The latter I have done in the past.
Note1: Japanese date notation: Wikipedia note
Note2: I think the new date() code has one other improvement, when the admin side is set to Japanese, the date selectors display the month (August at time of writing) as 8月, previously this was not translated. That is great.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: [RFC] Calendars support?
PS – The calendar attribute works well otherwise, i tried backdating articles to the Heisei era (8 January 1989 – 30 April 2019) and Showa era (December 25, 1926 – January 7, 1989). I did not try earlier.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: [RFC] Calendars support?
@phiw13 thanks for testing, Philippe. Default (%c, %x and %X) date formats are delegated to PHP. Currently they are set to SHORT form, we can switch them to LONG if necessary. I’ve kept the other txp %_ formats intact, but they do not support well Oriental languages. Will see if we can fine-tune them. Leave me few hours minutes and it will be possible to use ICU formats too, just don’t mix both.
I also think that the default list of txp formats should be reduced in favour of custom ones.
Offline
Re: [RFC] Calendars support?
etc wrote #331287:
@phiw13 thanks for testing, Philippe. Default (
%c,%xand%X) date formats are delegated to PHP. Currently they are set toSHORTform, we can switch them toLONGif necessary. I’ve kept the other txp%_formats intact, but they do not support well Oriental languages. Will see if we can fine-tune them. Leave me few hours and it will be possible to use ICU formats too, just don’t mix both.
Thanks for taking the time to investigate further! If it is PHP doing most of the lifting, then OK. As I said, given what we have now, it is possible to build the dates in a variety of formats, long and short. A bit of manual tweaking, but OK.
I also think that the default list of txp formats should be reduced in favour of custom ones.
+1 on that one. That would simplify the UI and remove some ambiguity.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: [RFC] Calendars support?
etc wrote #331275:
(provided php
intlextension is enabled)
Now added as a recommended module in Textpattern system requirements
Offline
Re: [RFC] Calendars support?
gaekwad wrote #331290:
Now added as a recommended module in Textpattern system requirements
Good idea, thanks!
Offline
Re: [RFC] Calendars support?
Oleg, you latest changes to date (using IntlDateFormatter::LONG) look good.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: [RFC] Calendars support?
Thanks. Custom formats should be possible now. Users opinion is needed re UI and the default formats list (which looks too long for me).
Offline
Re: [RFC] Calendars support?
etc wrote #331312:
Thanks. Custom formats should be possible now. Users opinion is needed re UI and the default formats list (which looks too long for me).
- definitely agree on the need to prune that list – as it is, I nearly always end up customising the
<txp:posted />and <txp:modified />@ format. Not sure what to recommend, though. Thesinceformat is a keeper I think, others dunno yet? - is customising the format fully reflected in the
<select />? If I put%x, I getAug 13, 10.01 amin that pop up, I would expect13 August 2021(PHP docs, and Public side outputs that). - I need to thing a little about the UI.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline
Re: [RFC] Calendars support?
phiw13 wrote #331318:
The
sinceformat is a keeper I think, others dunno yet?
Sure, plus 3-4 formats containing main % patterns, for illustration.
If I put
%x, I getAug 13, 10.01 amin that pop up, I would expect13 August 2021(PHP docs, and Public side outputs that).
You need to save prefs before a format gets updated by PHP. Doing it in JS would be not reliable, and sending an AJAX request on each key stroke is too expensive.
Also note that formats are displayed in the user’s language, that can be different from the site language.
Offline
Re: [RFC] Calendars support?
etc wrote #331320:
You need to save prefs before a format gets updated by PHP. Doing it in JS would be not reliable, and sending an AJAX request on each key stroke is too expensive.
Sure, saving I did, and left the tab, and closed the browser window since this AM. Look (screen grab)
(and it is all en-gb)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
phiw13 on Codeberg
Offline