Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#16 2021-08-10 10:42:18

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,795
GitHub

Re: [RFC] Calendars support?

etc wrote #331267:

@gaekwad btw, is 4.8.8 demo Back Soon?

Now fixed. Apologies for the downtime.

Offline

#17 2021-08-10 10:44:44

etc
Developer
Registered: 2010-11-11
Posts: 5,689
Website GitHub

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

#18 2021-08-10 20:47:38

etc
Developer
Registered: 2010-11-11
Posts: 5,689
Website GitHub

Re: [RFC] Calendars support?

Bloke wrote #331258:

Kjeld would love us :)

Love is in the air (provided php intl extension is enabled):

<txp:posted calendar="japanese" format="%c" />

Offline

#19 2021-08-10 23:12:00

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,670
Website

Re: [RFC] Calendars support?

etc wrote #331275:

Love is in the air (provided php intl extension 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

#20 2021-08-11 06:20:01

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,670
Website

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

#21 2021-08-11 06:35:22

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,670
Website

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

#22 2021-08-11 08:31:00

etc
Developer
Registered: 2010-11-11
Posts: 5,689
Website GitHub

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

#23 2021-08-11 08:49:13

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,670
Website

Re: [RFC] Calendars support?

etc wrote #331287:

@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 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

#24 2021-08-11 10:45:15

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,795
GitHub

Re: [RFC] Calendars support?

etc wrote #331275:

(provided php intl extension is enabled)

Now added as a recommended module in Textpattern system requirements

Offline

#25 2021-08-11 14:12:24

etc
Developer
Registered: 2010-11-11
Posts: 5,689
Website GitHub

Re: [RFC] Calendars support?

gaekwad wrote #331290:

Now added as a recommended module in Textpattern system requirements

Good idea, thanks!

Offline

#26 2021-08-12 07:06:18

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,670
Website

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

#27 2021-08-12 08:37:39

etc
Developer
Registered: 2010-11-11
Posts: 5,689
Website GitHub

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

#28 2021-08-13 01:08:22

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,670
Website

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).

  1. 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. The since format is a keeper I think, others dunno yet?
  2. is customising the format fully reflected in the <select /> ? If I put %x, I get Aug 13, 10.01 am in that pop up, I would expect 13 August 2021 (PHP docs, and Public side outputs that).
  3. 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

#29 2021-08-13 08:04:50

etc
Developer
Registered: 2010-11-11
Posts: 5,689
Website GitHub

Re: [RFC] Calendars support?

phiw13 wrote #331318:

The since format is a keeper I think, others dunno yet?

Sure, plus 3-4 formats containing main % patterns, for illustration.

If I put %x, I get Aug 13, 10.01 am in that pop up, I would expect 13 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

#30 2021-08-13 08:31:42

phiw13
Plugin Author
From: South-Western Japan
Registered: 2004-02-27
Posts: 3,670
Website

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

Board footer

Powered by FluxBB