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

I18n overriding of Chronos #12477

Closed
1 of 3 tasks
gaetansnl opened this issue Aug 15, 2018 · 3 comments
Closed
1 of 3 tasks

I18n overriding of Chronos #12477

gaetansnl opened this issue Aug 15, 2018 · 3 comments

Comments

@gaetansnl
Copy link
Contributor

gaetansnl commented Aug 15, 2018

This is a (multiple allowed):

  • bug
  • enhancement
  • feature-discussion (RFC)

Chronos FrozenTime is partially overridden in CakePHP I18n.
But Chronos use DateTime format and Cakephp I18n use ICU format and they are very different...
So on CakePHP I18n FrozenTime I can call FrozenTime::createFromFormat but the accepted format is DateTime format and not ICU.

createFromFormat and parseDateTime docs are explicit but we don't really understand why functions are named and mixed this way.

It's just a suggestion but maybe for Cake 4, separation should be clearer between ICU and DateTime. FrozenTime could still handle both formats but be a real abstraction over DateTime and IntlDateFormatter, with explicit names for parsing and formatting functions.

@markstory markstory added this to the 4.0.0 milestone Aug 16, 2018
@markstory markstory added the i18n label Aug 16, 2018
@markstory
Copy link
Member

Would you also want to separate Intl based output formatting from DateTime based formatting?

@gaetansnl
Copy link
Contributor Author

gaetansnl commented Aug 16, 2018

For output there's already i18nFormat for ICU format I think.

This is what I found :

Functions taking ICU :

  • parseDateTime
  • parseDate
  • parseTime
  • i18nFormat

Function taking DateTime format :

  • createFromFormat
  • format inherited from DateTime
  • maybe some other inherited functions from DateTime

For formating I think it's ok because $_toStringFormat and $_jsonEncodeFormat are fully overidden, and ICU formatting function start with prefix i18n. I don't think functions like toIso8601String are a problem because they don't take format as argument.

For parsing, maybe the easiest should be to prefix Intl methods with i18n. Or to prefix DateTime methods.

My personnal opinion is that only ICU format should be supported but I'm pretty sure people are still using DateTime format a lot...

@github-actions
Copy link

This issue is stale because it has been open for 120 days with no activity. Remove the stale label or comment or this will be closed in 15 days

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

3 participants