Skip to content

Make I18n component completely optional for Mvc #5406

Merged
merged 5 commits into from Jan 3, 2014

7 participants

@DASPRiD
Zend Framework member
DASPRiD commented Nov 2, 2013

Should be fully functional by now. Closes #5108

@weierophinney weierophinney was assigned Nov 2, 2013
@weierophinney weierophinney commented on an outdated diff Nov 5, 2013
library/Zend/Mvc/I18n/Translator.php
@@ -12,6 +12,23 @@
use Zend\I18n\Translator\Translator as I18nTranslator;
use Zend\Validator\Translator\TranslatorInterface as ValidatorTranslatorInterface;
-class Translator extends I18nTranslator implements ValidatorTranslatorInterface
+class Translator implements ValidatorTranslatorInterface
@weierophinney
Zend Framework member
weierophinney added a note Nov 5, 2013

The problem with this change is it means that the MvcTranslator can no longer be dropped in when you need a Translator instance.

I'm honestly not sure how to proceed, however -- if you create an interface in the Zend\I18n\Translator namespace, we then have the problem of PHP <= 5.3.8 not being able to allow implementing two interfaces with the same signature.

This begs a question, then: should we up our minimum required version starting with 2.3.0 to PHP 5.3.9? This might solve a number of lingering issues such as this one, as well as some with ArrayObject.

Could you start a thread on the dev mailing list asking about this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@dphn
dphn commented Dec 6, 2013

Excuse me, are just two question.

  • Why is translator not the traits?
  • Why do not php 5.4? All the same. It is inevitable, why small jumps. It will only upset users. I think it's better to make one big step.
@Ocramius
Zend Framework member
Ocramius commented Dec 6, 2013

@dphn ZF2 remainst 5.3 compatible - ZF3 is where we'd target 5.4. No breakage on that side within 2.x

@dphn
dphn commented Dec 6, 2013

Now php 5.4 is even available for free hosting

@mpalourdio

yep, but not available by default on redhat like distros :( Even if alternative repos like Remi's ones are the first thing to implement when using CentOS IMHO

@dphn
dphn commented Dec 6, 2013

What a pity! Have to wait until ZF ~ 2.7 - 2.8 But I think, a better one stride than several small ones.
P.S. http://linux.ioerror.us/2013/02/installing-php-5-4-11-on-centos-6-3

@weierophinney
Zend Framework member

@dphn Please keep discussion on the mailing list, not comments on the issue tracker.

@weierophinney weierophinney commented on the diff Jan 3, 2014
library/Zend/View/HelperPluginManager.php
$helper->setTranslator($locator->get('translator'));
+ } elseif ($locator && $locator->has('MvcTranslator')) {
+ $helper->setTranslator($locator->get('MvcTranslator'));
@weierophinney
Zend Framework member
weierophinney added a note Jan 3, 2014

I would argue we should prefer the MvcTranslator over the Translator service here. The assumption is that the MvcTranslator service is the "bridge" implementation, and would be the one shared between all translator-aware services.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@weierophinney weierophinney added a commit that referenced this pull request Jan 3, 2014
@weierophinney weierophinney [#5406] Logic and order-of-ops cleanup
- Prefer the MvcTranslator service over the translator service
- Applied object calisthenics and removed nested conditionals
475c891
@weierophinney weierophinney added a commit that referenced this pull request Jan 3, 2014
@weierophinney weierophinney Merge branch 'feature/5406' into develop
Close #5406
Fixes #5108
2fb32fe
@weierophinney weierophinney merged commit 64e4dc1 into zendframework:develop Jan 3, 2014

1 check passed

Details default The Travis CI build passed
@coolmic coolmic commented on the diff Jan 6, 2014
library/Zend/Mvc/Service/TranslatorServiceFactory.php
@@ -17,14 +17,14 @@
* Overrides the translator factory from the i18n component in order to
* replace it with the bridge class from this namespace.
*/
-class TranslatorServiceFactory extends I18nTranslatorServiceFactory
+class TranslatorServiceFactory
@coolmic
coolmic added a note Jan 6, 2014

I am getting

Zend\ServiceManager\Exception\ServiceNotCreatedException
While attempting to create mvctranslator(alias: MvcTranslator) an invalid factory was registered for this instance type.

Should you not implement FactoryInterface?

@netiul
netiul added a note Jan 6, 2014

Yeah, now it's an invalid factory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@netiul netiul referenced this pull request Jan 6, 2014
Closed

Re-added factory interface #5685

@weierophinney weierophinney added a commit to weierophinney/zf2 that referenced this pull request Jan 6, 2014
@weierophinney weierophinney Added note to README
- Covers #5406, and the changes also present in this PR.
621bfca
@weierophinney weierophinney added a commit to zendframework/zend-i18n that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge pull request zendframework/zf2#5406 from DASPRiD/bugfix/mvc-tra…
…nslator-wrapper

Make I18n component completely optional for Mvc
0785f49
@weierophinney weierophinney added a commit to zendframework/zend-i18n that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'feature/5406' into develop 4fdfdac
@weierophinney weierophinney added a commit to zendframework/zend-file that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge pull request zendframework/zf2#5406 from DASPRiD/bugfix/mvc-tra…
…nslator-wrapper

Make I18n component completely optional for Mvc
80f7f1f
@weierophinney weierophinney added a commit to zendframework/zend-file that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'feature/5406' into develop e9876a6
@weierophinney weierophinney added a commit to zendframework/zend-view that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge pull request zendframework/zf2#5406 from DASPRiD/bugfix/mvc-tra…
…nslator-wrapper

Make I18n component completely optional for Mvc
7fc80e0
@weierophinney weierophinney added a commit to zendframework/zend-view that referenced this pull request May 15, 2015
@weierophinney weierophinney [zendframework/zf2#5406] Logic and order-of-ops cleanup
- Prefer the MvcTranslator service over the translator service
- Applied object calisthenics and removed nested conditionals
51e49f6
@weierophinney weierophinney added a commit to zendframework/zend-view that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'feature/5406' into develop 36b3f99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.