Skip to content
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

Saving article throws an error when trying to change the Start and Finish Publishing dates on a multilingual site #40364

Closed
FlorianGeorgiev opened this issue Apr 10, 2023 · 7 comments

Comments

@FlorianGeorgiev
Copy link

Steps to reproduce the issue

Vanilla J 4.2.9 (i spotted it in 4.3.2 as well).
Install a second language (Bulgarian in my case).
Make the needed steps, so the second language becomes available.
Log on with the second language (Bulgarian).
Make a new article.
Change the Start or Finish Publishing date.
Then try to save the article.

Expected result

The article should be saved.

Actual result

Trying saving it, it throws an error: 0 Call to a member function format() on bool

System information (as much as possible)

Vanilla Joomla 4.2.9.
PHP 8.2
Second Language installed (Bulgarian).

Additional comments

When the date format for a given language is different than the format of the British English (the default) language, trying to change Start or Finish publishing throw an error: 0 Call to a member function format() on bool. I think this comes from the different date formats of the different languages. For British English is YYYY-MM-DD, for Bulgarian is DD.MM.YYYY.
I tried to use the British English date formatting while I'm logged with Bulgarian language, but it still throws an error.

@FlorianGeorgiev FlorianGeorgiev changed the title Saving article throws an error when trying to change the Start and Finish Publishing dates ona multilingual site Saving article throws an error when trying to change the Start and Finish Publishing dates on a multilingual site Apr 10, 2023
@richard67
Copy link
Member

richard67 commented Apr 11, 2023

@FlorianGeorgiev I think that the error is in the Bulgarian language pack (and possibly also others).

The date formats are defined in file language/<tag>/joomla.ini, with <tag> being the language tag, e.g. "bg-BG".

The format "DATE_FORMAT_CALENDAR_DATE" has to be consistent with "DATE_FORMAT_FILTER_DATE", and the format "DATE_FORMAT_CALENDAR_DATETIME" has to be consistent with "DATE_FORMAT_FILTER_DATETIME".

Consistent means they should have the same order of parts and the same separator.

Correct in the en-GB core file:

DATE_FORMAT_CALENDAR_DATE="%Y-%m-%d"
DATE_FORMAT_CALENDAR_DATETIME="%Y-%m-%d %H:%M:%S"
DATE_FORMAT_FILTER_DATE="Y-m-d"
DATE_FORMAT_FILTER_DATETIME="Y-m-d H:i:s"

Correct in the latest German language pack:

DATE_FORMAT_CALENDAR_DATE="%d.%m.%Y"
DATE_FORMAT_CALENDAR_DATETIME="%d.%m.%Y %H:%M:%S"
DATE_FORMAT_FILTER_DATE="d.m.Y"
DATE_FORMAT_FILTER_DATETIME="d.m.Y H:i:s"

Incorrect in the latest Bulgarian language pack:

DATE_FORMAT_CALENDAR_DATE="%d.%m.%Y"
DATE_FORMAT_CALENDAR_DATETIME="%d.%m.%Y %H:%M:%S"
DATE_FORMAT_FILTER_DATE="d-m-Y"
DATE_FORMAT_FILTER_DATETIME="d-m-Y H:i:s"

As you can see, the "DATE_FORMAT_CALENDAR_..." strings use the right Bulgarian format, which is the same as in German by the way, but the "DATE_FORMAT_FILTER_..." strings use the wrong date separators "-".

Could you change the "DATE_FORMAT_FILTER_DATE" and "DATE_FORMAT_FILTER_DATETIME" so they are the same as in the German example above, then test if that helped and then report back the result here?

If I'm right, then it's not an issue with the CMS core but with the translation, then it should be reported to the Bulgarian translation team coordinator, which can be found here https://downloads.joomla.org/language-packs/translations-joomla4 .

@FlorianGeorgiev
Copy link
Author

Wooow, this is just amazing! @richard67, thank you for helping me out.
I edited joomla.ini for my language and it worked out!
I even didn't know that these formats are stored in a leanguage file, i thought there are somewhere in a php and i'm not a developer, so.. you understand.
I changed the formats like this:
DATE_FORMAT_CALENDAR_DATE="%d.%m.%Y"
DATE_FORMAT_CALENDAR_DATETIME="%d.%m.%Y %H:%M:%S"
DATE_FORMAT_FILTER_DATE="d.m.Y"
DATE_FORMAT_FILTER_DATETIME="d.m.Y H:i:s"

Since we use fullstops for separators of the date elements, I put fullstops.
There are another 4 strings (variables) which I am uncertain if I must change them as well.
Here they are:
DATE_FORMAT_LC4="d-m-Y"
DATE_FORMAT_LC5="d-m-Y H:i"
DATE_FORMAT_LC6="d-m-Y H:i:s"
DATE_FORMAT_JS1="d-m-y"

As you can see, they use dashes instead of fullstops. Should I edit them accordingly as well and put fullstops instead of dashes?

Thanks in advance.

Once we finish here, I'll report it to the coordinator of the Bulgarian language (if there is one). I even could provide the joomla.ini file.

Thanks again.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40364.

@richard67
Copy link
Member

Since we use fullstops for separators of the date elements, I put fullstops. There are another 4 strings (variables) which I am uncertain if I must change them as well. Here they are: DATE_FORMAT_LC4="d-m-Y" DATE_FORMAT_LC5="d-m-Y H:i" DATE_FORMAT_LC6="d-m-Y H:i:s" DATE_FORMAT_JS1="d-m-y"

As you can see, they use dashes instead of fullstops. Should I edit them accordingly as well and put fullstops instead of dashes?

@FlorianGeorgiev Yes, those can be changed, too. They are only used for formatting output so not cause such an error like it was with the calendar formats, but they should of course fit to your country. As far as I can see, the only difference between Bulgarian and German is that we use also a dot with the long month names, e.g. "13. Mai", while you do not use the dots in the these formats. And these formats are already correct in the Bulgarian language file, so with my suggested change and the additional change mentioned by you it would be completely ok.

Once we finish here, I'll report it to the coordinator of the Bulgarian language (if there is one). I even could provide the joomla.ini file.

That would be great. You find the coordinator for each language here: https://downloads.joomla.org/language-packs/translations-joomla4 .

@FlorianGeorgiev
Copy link
Author

I was talking about /language/bg-BG/joomla.ini

Now I found another file with mixed (I think so) date formats. It is /api/language/bg-BG/joomla.ini
So I edited them as well.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40364.

@FlorianGeorgiev
Copy link
Author

Sorry for the multiple replies.
I found another file with mixed date formats: /administrator/language/bg-BG/joomla.ini
It could help someone.

p.s. I already found the coordinator and send him a message.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40364.

@richard67
Copy link
Member

@FlorianGeorgiev Yes, the other files might need to be fixed, too. Thanks for notifying the coordinator. I close the issue here because it's not an issue with the CMS core.

@pl71
Copy link

pl71 commented Apr 13, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants