-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
RFC: Support for other calendars and date conversion in localization process #6536
Conversation
*/ | ||
public static function getCalendarName($locale = null) | ||
{ | ||
if (is_null($locale)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually stick to === null
to avoid a function call.
65ec434
to
5edbb3d
Compare
@@ -52,7 +52,7 @@ class DateTimeType extends Type | |||
* | |||
* @var string|array|int | |||
*/ | |||
protected $_localeFormat; | |||
protected $_localeFormat = 'yyyy-MM-dd hh:mm:ss'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The locale format does not have to be this, it is actually going to be different per locale
1571068
to
f209ad5
Compare
@zoghal Could you update this into a state where it can be merged again? |
$timezone = isset($value['timezone']) ? $value['timezone'] : null; | ||
|
||
if (isset($value['locale'])) { | ||
$format = $this->_parseValue($format, $timezone, 'fa_IR@calendar=persian'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this line use the locale
value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄 😄 this for test and tracing.Please ignore this codes.
@markstory I'm working on it. but on other branch.
just code of this branch is a bit dirty. I will cleaning and transfer these branches on the next few days |
6cc41e4
to
e760f75
Compare
e760f75
to
c5fff71
Compare
@markstory Changes and updates are finished, please check |
*/ | ||
public static function detectCalendarType($locale = null) | ||
{ | ||
if (preg_match('/@calendar=(japanese|buddhist|chinese|persian|indian|islamic|hebrew|coptic|ethiopic)/', $locale)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you dont need the preg_match if null is passed, maybe adding
if ($locale && ...)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
*/ | ||
public static function setDefaultCalendar($calendar) | ||
{ | ||
static::$defaultCalendar = $calendar; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahouldd you check that this method gets a string? Right now other methods may misbehave if 0/false is provided.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes yes , You are right
8ff208e
to
c50ff9a
Compare
-ORM support localizion Date and time
Closing as this branch can no longer be merged. If you have time to update it, please reopen the pull request 😄. |
Yes it is closed. Unfortunately I am unaware 6 months of updates. And this should be implemented. |
Before the push the tests was wondering if you have any suggestions for this feature? these changes is ok?