You are here

protected function IcuResFileLoader::flatten in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/translation/Loader/IcuResFileLoader.php \Symfony\Component\Translation\Loader\IcuResFileLoader::flatten()

Flattens an ResourceBundle.

The scheme used is: key { key2 { key3 { "value" } } } Becomes: 'key.key2.key3' => 'value'

This function takes an array by reference and will modify it

Parameters

\ResourceBundle $rb the ResourceBundle that will be flattened:

array $messages used internally for recursive calls:

string $path current path being parsed, used internally for recursive calls:

Return value

array the flattened ResourceBundle

2 calls to IcuResFileLoader::flatten()
IcuDatFileLoader::load in vendor/symfony/translation/Loader/IcuDatFileLoader.php
Loads a locale.
IcuResFileLoader::load in vendor/symfony/translation/Loader/IcuResFileLoader.php
Loads a locale.

File

vendor/symfony/translation/Loader/IcuResFileLoader.php, line 79

Class

IcuResFileLoader
IcuResFileLoader loads translations from a resource bundle.

Namespace

Symfony\Component\Translation\Loader

Code

protected function flatten(\ResourceBundle $rb, array &$messages = array(), $path = null) {
  foreach ($rb as $key => $value) {
    $nodePath = $path ? $path . '.' . $key : $key;
    if ($value instanceof \ResourceBundle) {
      $this
        ->flatten($value, $messages, $nodePath);
    }
    else {
      $messages[$nodePath] = $value;
    }
  }
  return $messages;
}