Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Decouple I18n\View\Helper\AbstractTranslatorHelper from ext\intl #4380

Closed
wants to merge 1 commit into from

Conversation

Slamdunk
Copy link
Contributor

@Slamdunk Slamdunk commented May 2, 2013

https://github.com/zendframework/zf2/blob/release-2.2.0rc1/library/Zend/I18n/View/Helper/AbstractTranslatorHelper.php#L34-L45

is too wide and involves also

https://github.com/zendframework/zf2/blob/release-2.2.0rc1/library/Zend/Form/View/Helper/AbstractHelper.php#L13

which has nothing to do with ext\intl apart for FormMonthSelect and its descendants

Without this fix, no Form\View\Helper can be used if ext\intl is missing.

I had to put some attribute initialization into constructors to avoid unmanagable fatal errors.

@prolic
Copy link
Contributor

prolic commented May 2, 2013

+1

{
parent::__construct();

$this->timeType = IntlDateFormatter::LONG;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing the exception in this area.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mwillbanks It's thrown by the parent constructor.

@mwillbanks
Copy link
Contributor

Please also supply unit tests to verify the behavior.

@Slamdunk
Copy link
Contributor Author

Slamdunk commented May 2, 2013

@mwillbanks there is no test written for other extension checking like

https://github.com/zendframework/zf2/blob/release-2.2.0rc1/library/Zend/I18n/Filter/AbstractLocale.php#L21-L29

and many others.

Btw, I'll be happy to create tests if anyone can make a Travis build without ext\intl loaded.

@@ -12,6 +12,7 @@
use Locale;
use IntlDateFormatter;
use Traversable;
use Zend\I18n\Exception as I18nException;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to alias.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ghost ghost assigned weierophinney May 2, 2013
weierophinney added a commit that referenced this pull request May 2, 2013
Decouple I18n\View\Helper\AbstractTranslatorHelper from ext\intl
weierophinney added a commit that referenced this pull request May 2, 2013
- s/Extensions/Extension/g
- Added explanatory comments
- Alias both exception types in DateTime validator
weierophinney added a commit that referenced this pull request May 2, 2013
weierophinney added a commit to zendframework/zend-i18n that referenced this pull request May 15, 2015
…fix/intl-optional

Decouple I18n\View\Helper\AbstractTranslatorHelper from ext\intl
weierophinney added a commit to zendframework/zend-i18n that referenced this pull request May 15, 2015
- s/Extensions/Extension/g
- Added explanatory comments
- Alias both exception types in DateTime validator
weierophinney added a commit to zendframework/zend-i18n that referenced this pull request May 15, 2015
weierophinney added a commit to zendframework/zend-i18n that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants