public function filter($translations)
    {
        $cleanedTranslations = array();

        foreach ($translations as $pluginName => $pluginTranslations) {

            foreach ($pluginTranslations as $key => $translation) {

                if (isset($this->baseTranslations[$pluginName][$key])) {
                    $baseTranslation = $this->baseTranslations[$pluginName][$key];
                } else {
                    // english string was deleted, do not error
                    continue;
                }

                // ensure that translated strings have the same number of %s as the english source strings
                $baseCount = $this->_getParametersCountToReplace($baseTranslation);
                $translationCount = $this->_getParametersCountToReplace($translation);

                if ($baseCount != $translationCount) {

                    $this->filteredData[$pluginName][$key] = $translation;
                    continue;
                }

                $cleanedTranslations[$pluginName][$key] = $translation;
            }
        }

        return $cleanedTranslations;
    }
public function filter($translations)
    {
        $cleanedTranslations = array();

        foreach ($translations as $pluginName => $pluginTranslations) {

            foreach ($pluginTranslations as $key => $translation) {

                if (isset($this->baseTranslations[$pluginName][$key])) {
                    $baseTranslation = $this->baseTranslations[$pluginName][$key];
                } else {
                    // english string was deleted, do not error
                    continue;
                }

                // ensure that translated strings have the same number of %s as the english source strings
                $baseCount = $this->_getParametersCountToReplace($baseTranslation);
                $translationCount = $this->_getParametersCountToReplace($translation);

                if ($baseCount != $translationCount) {

                    $this->filteredData[$pluginName][$key] = $translation;
                    continue;
                }

                $cleanedTranslations[$pluginName][$key] = $translation;
            }
        }

        return $cleanedTranslations;
    }
public function filter ( $ translations ) { $ cleanedTranslations = array ( ) ; foreach ( $ translations as $ pluginName => $ pluginTranslations ) { foreach ( $ pluginTranslations as $ key => $ translation ) { if ( isset ( $ this -> baseTranslations [ $ pluginName ] [ $ key ] ) ) { $ baseTranslation = $ this -> baseTranslations [ $ pluginName ] [ $ key ] ; } else { // english string was deleted, do not error continue ; } // ensure that translated strings have the same number of %s as the english source strings $ baseCount = $ this -> _getParametersCountToReplace ( $ baseTranslation ) ; $ translationCount = $ this -> _getParametersCountToReplace ( $ translation ) ; if ( $ baseCount != $ translationCount ) { $ this -> filteredData [ $ pluginName ] [ $ key ] = $ translation ; continue ; } $ cleanedTranslations [ $ pluginName ] [ $ key ] = $ translation ; } } return $ cleanedTranslations ; }
Removes all translations where the placeholder parameter count differs to base translation

@param  array $translations

@return array   filtered translations
Removes all translations where the placeholder parameter count differs to base translation