protected function IcuResFileLoader::flatten in Plug 7
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 lib/
Symfony/ translation/ Loader/ IcuDatFileLoader.php - Loads a locale.
- IcuResFileLoader::load in lib/
Symfony/ translation/ Loader/ IcuResFileLoader.php - Loads a locale.
File
- lib/
Symfony/ translation/ Loader/ IcuResFileLoader.php, line 79
Class
- IcuResFileLoader
- IcuResFileLoader loads translations from a resource bundle.
Namespace
Symfony\Component\Translation\LoaderCode
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;
}