protected function buildTranslationtable($locale, array $namespaces)
    {
        // The resulting array
        $result = [];

        // Assume init was done already
        $fresh = false;

        // check if locale was prepared before
        if (!isset(self::$translations[$locale])) {
            self::$translations[$locale] = [];
            $fresh                       = true;
        }

        // Iterate namespaces and parse ...
        foreach ($namespaces as $namespace) {
            // was this namespace in the current locale loaded before
            if (!$fresh && isset(self::$translations[$locale][$namespace])) {
                // we can reuse the existing
                $result = array_merge($result, self::$translations[$locale][$namespace]);
            } else {
                // Load fresh from file
                $translationFile = $this->path.$locale.DIRECTORY_SEPARATOR.self::TRANSLATION_FILES_DIRECTORY.
                                   DIRECTORY_SEPARATOR.$this->normalizeLocale($locale).DIRECTORY_SEPARATOR.
                                   'LC_MESSAGES'.DIRECTORY_SEPARATOR.
                                   $namespace.'.'.self::TRANSLATION_FILES_EXTENSION;

                $result = array_merge($result, $this->parseTranslationfile($translationFile));
            }
        }

        // return the resulting table
        return $result;
    }
protected function buildTranslationtable($locale, array $namespaces)
    {
        // The resulting array
        $result = [];

        // Assume init was done already
        $fresh = false;

        // check if locale was prepared before
        if (!isset(self::$translations[$locale])) {
            self::$translations[$locale] = [];
            $fresh                       = true;
        }

        // Iterate namespaces and parse ...
        foreach ($namespaces as $namespace) {
            // was this namespace in the current locale loaded before
            if (!$fresh && isset(self::$translations[$locale][$namespace])) {
                // we can reuse the existing
                $result = array_merge($result, self::$translations[$locale][$namespace]);
            } else {
                // Load fresh from file
                $translationFile = $this->path.$locale.DIRECTORY_SEPARATOR.self::TRANSLATION_FILES_DIRECTORY.
                                   DIRECTORY_SEPARATOR.$this->normalizeLocale($locale).DIRECTORY_SEPARATOR.
                                   'LC_MESSAGES'.DIRECTORY_SEPARATOR.
                                   $namespace.'.'.self::TRANSLATION_FILES_EXTENSION;

                $result = array_merge($result, $this->parseTranslationfile($translationFile));
            }
        }

        // return the resulting table
        return $result;
    }
protected function buildTranslationtable ( $ locale , array $ namespaces ) { // The resulting array $ result = [ ] ; // Assume init was done already $ fresh = false ; // check if locale was prepared before if ( ! isset ( self :: $ translations [ $ locale ] ) ) { self :: $ translations [ $ locale ] = [ ] ; $ fresh = true ; } // Iterate namespaces and parse ... foreach ( $ namespaces as $ namespace ) { // was this namespace in the current locale loaded before if ( ! $ fresh && isset ( self :: $ translations [ $ locale ] [ $ namespace ] ) ) { // we can reuse the existing $ result = array_merge ( $ result , self :: $ translations [ $ locale ] [ $ namespace ] ) ; } else { // Load fresh from file $ translationFile = $ this -> path . $ locale . DIRECTORY_SEPARATOR . self :: TRANSLATION_FILES_DIRECTORY . DIRECTORY_SEPARATOR . $ this -> normalizeLocale ( $ locale ) . DIRECTORY_SEPARATOR . 'LC_MESSAGES' . DIRECTORY_SEPARATOR . $ namespace . '.' . self :: TRANSLATION_FILES_EXTENSION ; $ result = array_merge ( $ result , $ this -> parseTranslationfile ( $ translationFile ) ) ; } } // return the resulting table return $ result ; }
builds a translation-tables for giving locale and namespace.

This method is intend to build a translation-tables for giving locale and namespace.

@param string $locale     The locale the table get build for
@param array  $namespaces The namespace(s) of the table get build for

@author Benjamin Carl <opensource@clickalicious.de>

@return array The final translationtable for given locale + namespace
builds a translation - tables for giving locale and namespace .