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
[Intl] Form Money type / decimal type without intl installed don't work #8588
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -458,6 +458,25 @@ public function getPattern() | |
*/ | ||
public function getSymbol($attr) | ||
{ | ||
// Need a minimum implementation to make the "en" locale work | ||
// when the "intl" extension is not installed (Issue #6045) | ||
switch ($attr) { | ||
case self::DECIMAL_SEPARATOR_SYMBOL: | ||
return '.'; | ||
case self::GROUPING_SEPARATOR_SYMBOL: | ||
return ','; | ||
case self::DIGIT_SYMBOL: | ||
return '#'; | ||
case self::CURRENCY_SYMBOL: | ||
return '$'; | ||
case self::EXPONENTIAL_SYMBOL: | ||
return 'E'; | ||
default: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is useless. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just being explicit that we do nothing in the default case. Some like that coding style, some don't. |
||
; | ||
} | ||
|
||
// Apart from what is implemented above | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what are the missing symbols to be able to consider the implementation as complete (and so being able to properly return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You find them on lines 96-113 in the same file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldn't we implement it then ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. http://www.icu-project.org/apiref/icu4c/classDecimalFormat.html#details scroll down to "Special Pattern Characters" |
||
// this function is to be consiered as not implemented | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. consiered -> considered |
||
throw new MethodNotImplementedException(__METHOD__); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method is implemented, so it should not throw this exception. the php documentation says the method returns There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, it is not really implemented, it should still be considered as not implemented by application writers. To return false would be wrong, since it would reflect an incomplete and in those cases a wrong implementation. The function is partly implemented just to support symfonys own internal use of it when the PHP 'intl' extension is not there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, does it support all valid symbols or no ? Being implemented only for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Den 08. aug. 2013 16:06, skrev Christophe Coevoet:
Terje Bråten. |
||
} | ||
|
||
|
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 would remove this comment entirely. The whole stub intl is about providing a minimal implementation for the en locale. There is no need to comment it in this particular method
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.
It explains why this method is not left as just a throw new MethodNotImplementedException.
But if you do not like this comment, I can remove it.
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.
Please remove it as it is the same than for other methods
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.
Ok, will do that on next update