This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Check if a message is translated. | |
* | |
* @param string $message | |
* @param string $textDomain | |
* @param string $locale | |
* @return boolean | |
*/ | |
public function isTranslated($message, $textDomain = 'default', $locale = null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
------------------------------------------------------------------------------ | |
To be added (Zend\I18n namespace): | |
View helpers: | |
- DateFormat <DASPRiD> | |
- NumberFormat <cgmartin> | |
- Currency <cgmartin> | |
------------------------------------------------------------------------------ | |
Convert to work with DateTime, Intl extension and/or Zend\I18n\Translator: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$locale = $this->locale; | |
$fmt = new NumberFormatter($locale, NumberFormatter::DECIMAL); | |
if (intl_is_failure($fmt->getErrorCode())) { | |
throw new Exception\InvalidArgumentException("Invalid locale string given"); | |
} | |
$parsedFloat = $fmt->parse($value, NumberFormatter::TYPE_DOUBLE, $position); | |
if (intl_is_failure($fmt->getErrorCode()) || $position < strlen($value)) { | |
$this->error(self::NOT_FLOAT); | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following tasks need to be done to finish the i18n component: | |
------------------------------------------------------------------------------ | |
To finish translator: | |
- Add Xliff translation loader with plural support if possible, see: | |
https://wiki.oasis-open.org/xliff/XLIFF2.0/Feature/Plural%20Entries | |
- Add Tmx translation loader (identify if plural support is available) | |
- Complete unit tests | |
------------------------------------------------------------------------------ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Zend\EventManager\StaticEventManager; | |
use Zend\Mvc\MvcEvent; | |
use Locale; | |
$events = StaticEventManager::getInstance(); | |
$events->attach('Zend\Mvc\Application', 'route', function(MvcEvent $event){ | |
$request = $event->getRequest(); | |
$uri = $request->uri(); | |
$baseUrlLength = strlen($request->getBaseUrl() ?: ''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$routeStackDi = array( | |
'parameters' => array( | |
'routes' => array( | |
'language' => array( | |
'type' => 'Zend\Mvc\Router\Http\Segment', | |
'options' => array( | |
'route' => '[/:language]', | |
'constraints' => array( | |
'language' => '[a-z]{2}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Dear maintainer: | |
// | |
// Once you are done trying to 'optimize' this routine, | |
// and have realized what a terrible mistake that was, | |
// please increment the following counter as a warning | |
// to the next guy: | |
// | |
// total_hours_wasted_here = 39 | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Makes no sense insert comment after case A and B | |
switch ($foo) { | |
case 'a': | |
case 'b': | |
case 'c': | |
$bar = 'baz'; | |
break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
switch ($foo) { | |
case 'a': | |
$bar = 'a'; | |
case 'b': | |
case 'c': | |
$foo = 'a'; | |
break; | |
case 'd': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dasprid@dasprid-desktop:~/dev/flitch (master)$ ./flitch ../zf2/library/ | |
Flitch 0.1.0dev by Ben Scholzen. | |
../zf2/library/Zend/Soap/Client/DotNet.php: | |
-------------------------------------------------------------------------------- | |
75:error: Line may not be longer than 120 characters | |
../zf2/library/Zend/Soap/Client.php: | |
-------------------------------------------------------------------------------- | |
340:error: Line may not be longer than 120 characters |