MetaModels\DcGeneral\Dca\Builder\Builder::mapTranslations PHP Method

mapTranslations() protected method

Map all translation values from the given array to the given destination domain using the optional base key.
protected mapTranslations ( array $array, string $domain, string $baseKey = '' ) : void
$array array The array holding the translation values.
$domain string The target domain.
$baseKey string The base key to prepend the values of the array with.
return void
    protected function mapTranslations($array, $domain, $baseKey = '')
    {
        foreach ($array as $key => $value) {
            $newKey = ($baseKey ? $baseKey . '.' : '') . $key;
            if (is_array($value)) {
                $this->mapTranslations($value, $domain, $newKey);
            } else {
                $this->translator->setValue($newKey, $value, $domain);
            }
        }
    }