public function submitMissingKeys() {
        if ($this->missing_keys_by_sources == null)
            return;

        $params = array();
        $source_keys = array();
        foreach($this->missing_keys_by_sources as $source => $keys) {
            array_push($source_keys, $source);

            $keys_data = array();
            foreach($keys as $key) {
                /** @var $key TranslationKey */
                $json = array(
                    "key"           => $key->key,
                    "label"         => $key->label,
                    "description"   => $key->description,
                    "locale"        => $key->locale,
                    "level"         => $key->level
                );
                array_push($keys_data, $json);
            }
            array_push($params, array("source" => $source, "keys" => $keys_data));
        }

        $params = \Tr8n\Utils\ArrayUtils::trim($params);
        $this->apiClient()->post('source/register_keys', array("source_keys" => json_encode($params)));
        $this->missing_keys_by_sources = null;

        // All source caches must be reset for all languages, since the keys have changed
        foreach ($this->languages_by_locale as $locale => $language) {
            foreach ($source_keys as $source_key) {
                Cache::delete(Source::cacheKey($source_key, $locale));
            }
        }
    }
public function submitMissingKeys() {
        if ($this->missing_keys_by_sources == null)
            return;

        $params = array();
        $source_keys = array();
        foreach($this->missing_keys_by_sources as $source => $keys) {
            array_push($source_keys, $source);

            $keys_data = array();
            foreach($keys as $key) {
                /** @var $key TranslationKey */
                $json = array(
                    "key"           => $key->key,
                    "label"         => $key->label,
                    "description"   => $key->description,
                    "locale"        => $key->locale,
                    "level"         => $key->level
                );
                array_push($keys_data, $json);
            }
            array_push($params, array("source" => $source, "keys" => $keys_data));
        }

        $params = \Tr8n\Utils\ArrayUtils::trim($params);
        $this->apiClient()->post('source/register_keys', array("source_keys" => json_encode($params)));
        $this->missing_keys_by_sources = null;

        // All source caches must be reset for all languages, since the keys have changed
        foreach ($this->languages_by_locale as $locale => $language) {
            foreach ($source_keys as $source_key) {
                Cache::delete(Source::cacheKey($source_key, $locale));
            }
        }
    }
public function submitMissingKeys ( ) { if ( $ this -> missing_keys_by_sources == null ) return ; $ params = array ( ) ; $ source_keys = array ( ) ; foreach ( $ this -> missing_keys_by_sources as $ source => $ keys ) { array_push ( $ source_keys , $ source ) ; $ keys_data = array ( ) ; foreach ( $ keys as $ key ) { /** @var $key TranslationKey */ $ json = array ( "key" => $ key -> key , "label" => $ key -> label , "description" => $ key -> description , "locale" => $ key -> locale , "level" => $ key -> level ) ; array_push ( $ keys_data , $ json ) ; } array_push ( $ params , array ( "source" => $ source , "keys" => $ keys_data ) ) ; } $ params = \ Tr8n \ Utils \ ArrayUtils :: trim ( $ params ) ; $ this -> apiClient ( ) -> post ( 'source/register_keys' , array ( "source_keys" => json_encode ( $ params ) ) ) ; $ this -> missing_keys_by_sources = null ; // All source caches must be reset for all languages, since the keys have changed foreach ( $ this -> languages_by_locale as $ locale => $ language ) { foreach ( $ source_keys as $ source_key ) { Cache :: delete ( Source :: cacheKey ( $ source_key , $ locale ) ) ; } } }
Submits missing keys to the service
Submits missing keys to the service