Neos\Flow\I18n\Configuration::setFallbackRule PHP Method

setFallbackRule() public method

If this is given an order of [dk, za, fr_CA] a request for en_UK will be looked up in en_UK, en, dk, za, fr_CA, fr before trying the default locale. If strict flag is given in the array, the above example would instead look in en_UK, dk, za, fr_CA before trying the default locale. In other words, the implicit fallback is not applied to the locales in the fallback rule. Here is an example: array('strict' => FALSE, 'order' => array('dk', 'za'))
public setFallbackRule ( array $fallbackRule )
$fallbackRule array
    public function setFallbackRule(array $fallbackRule)
    {
        if (!array_key_exists('order', $fallbackRule)) {
            throw new \InvalidArgumentException('The given fallback rule did not contain an order element.', 1406710671);
        }
        if (!array_key_exists('strict', $fallbackRule)) {
            $fallbackRule['strict'] = false;
        }
        $this->fallbackRule = $fallbackRule;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * Initializes the locale service
  *
  * @return void
  */
 public function initializeObject()
 {
     $this->configuration = new Configuration($this->settings['defaultLocale']);
     $this->configuration->setFallbackRule($this->settings['fallbackRule']);
     if ($this->cache->has('availableLocales')) {
         $this->localeCollection = $this->cache->get('availableLocales');
     } else {
         $this->generateAvailableLocalesCollectionByScanningFilesystem();
         $this->cache->set('availableLocales', $this->localeCollection);
     }
 }