src/Controller/LanguageController.php
public function updateLanguageAction()
    {
        $response = array();
        $success = 0;
        $excludeModules = array('.', '..', '.gitignore', 'MelisSites', 'MelisInstaller');

        $textTitle = 'tr_meliscore_header_language_Language';
        $textMessage = 'tr_meliscore_tool_language_update_failed';

        $this->getEventManager()->trigger('meliscore_language_update_start', $this, $response);
        $translationSvc = $this->getServiceLocator()->get('MelisCoreTranslation');
        $moduleSvc = $this->getServiceLocator()->get('ModulesService');
        $vendorModules = $moduleSvc->getVendorModules();
        $melisCoreConfig = $this->getServiceLocator()->get('MelisCoreConfig');
        $directory = $melisCoreConfig->getItem('meliscore/datas/default/langauges/default_trans_dir');
        $melisTool = $this->getServiceLocator()->get('MelisCoreTool');
        $fullPathVendorModules = null;
        
        if($this->getRequest()->isPost()){
            $id = (int) $this->getRequest()->getPost('id');
            $locale = $melisTool->sanitize($this->getRequest()->getPost('locale'));
            if(!empty($locale)){
                foreach($vendorModules as $vModule) {

                    $vPath = $moduleSvc->getModulePath($vModule) . '/language/';
                    if(file_exists($vPath) && is_writable($vPath)) {
                        $fullPathVendorModules[] = array('module' => $vModule, 'path' => $vPath);
                    }
                }

                if($fullPathVendorModules) {
                    foreach($fullPathVendorModules as $vModuleConf) {
                        $success = $translationSvc->createOrUpdateTranslationFiles($vModuleConf['path'], $vModuleConf['module'], $locale);
                        if(!$success){
                            break;
                        }
                    }
                }

                if($success){
                    $textMessage = 'tr_meliscore_tool_language_edit_success';
                }
            }

        }

        $response = array(
            'textTitle' => $textTitle,
            'textMessage' => $textMessage,
            'success' => $success
        );
        $this->getEventManager()->trigger('meliscore_language_update_end', $this, $response);

        return new JsonModel($response);

    }
public function updateLanguageAction()
    {
        $response = array();
        $success = 0;
        $excludeModules = array('.', '..', '.gitignore', 'MelisSites', 'MelisInstaller');

        $textTitle = 'tr_meliscore_header_language_Language';
        $textMessage = 'tr_meliscore_tool_language_update_failed';

        $this->getEventManager()->trigger('meliscore_language_update_start', $this, $response);
        $translationSvc = $this->getServiceLocator()->get('MelisCoreTranslation');
        $moduleSvc = $this->getServiceLocator()->get('ModulesService');
        $vendorModules = $moduleSvc->getVendorModules();
        $melisCoreConfig = $this->getServiceLocator()->get('MelisCoreConfig');
        $directory = $melisCoreConfig->getItem('meliscore/datas/default/langauges/default_trans_dir');
        $melisTool = $this->getServiceLocator()->get('MelisCoreTool');
        $fullPathVendorModules = null;
        
        if($this->getRequest()->isPost()){
            $id = (int) $this->getRequest()->getPost('id');
            $locale = $melisTool->sanitize($this->getRequest()->getPost('locale'));
            if(!empty($locale)){
                foreach($vendorModules as $vModule) {

                    $vPath = $moduleSvc->getModulePath($vModule) . '/language/';
                    if(file_exists($vPath) && is_writable($vPath)) {
                        $fullPathVendorModules[] = array('module' => $vModule, 'path' => $vPath);
                    }
                }

                if($fullPathVendorModules) {
                    foreach($fullPathVendorModules as $vModuleConf) {
                        $success = $translationSvc->createOrUpdateTranslationFiles($vModuleConf['path'], $vModuleConf['module'], $locale);
                        if(!$success){
                            break;
                        }
                    }
                }

                if($success){
                    $textMessage = 'tr_meliscore_tool_language_edit_success';
                }
            }

        }

        $response = array(
            'textTitle' => $textTitle,
            'textMessage' => $textMessage,
            'success' => $success
        );
        $this->getEventManager()->trigger('meliscore_language_update_end', $this, $response);

        return new JsonModel($response);

    }
public function updateLanguageAction ( ) { $ response = array ( ) ; $ success = 0 ; $ excludeModules = array ( '.' , '..' , '.gitignore' , 'MelisSites' , 'MelisInstaller' ) ; $ textTitle = 'tr_meliscore_header_language_Language' ; $ textMessage = 'tr_meliscore_tool_language_update_failed' ; $ this -> getEventManager ( ) -> trigger ( 'meliscore_language_update_start' , $ this , $ response ) ; $ translationSvc = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreTranslation' ) ; $ moduleSvc = $ this -> getServiceLocator ( ) -> get ( 'ModulesService' ) ; $ vendorModules = $ moduleSvc -> getVendorModules ( ) ; $ melisCoreConfig = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreConfig' ) ; $ directory = $ melisCoreConfig -> getItem ( 'meliscore/datas/default/langauges/default_trans_dir' ) ; $ melisTool = $ this -> getServiceLocator ( ) -> get ( 'MelisCoreTool' ) ; $ fullPathVendorModules = null ; if ( $ this -> getRequest ( ) -> isPost ( ) ) { $ id = ( int ) $ this -> getRequest ( ) -> getPost ( 'id' ) ; $ locale = $ melisTool -> sanitize ( $ this -> getRequest ( ) -> getPost ( 'locale' ) ) ; if ( ! empty ( $ locale ) ) { foreach ( $ vendorModules as $ vModule ) { $ vPath = $ moduleSvc -> getModulePath ( $ vModule ) . '/language/' ; if ( file_exists ( $ vPath ) && is_writable ( $ vPath ) ) { $ fullPathVendorModules [ ] = array ( 'module' => $ vModule , 'path' => $ vPath ) ; } } if ( $ fullPathVendorModules ) { foreach ( $ fullPathVendorModules as $ vModuleConf ) { $ success = $ translationSvc -> createOrUpdateTranslationFiles ( $ vModuleConf [ 'path' ] , $ vModuleConf [ 'module' ] , $ locale ) ; if ( ! $ success ) { break ; } } } if ( $ success ) { $ textMessage = 'tr_meliscore_tool_language_edit_success' ; } } } $ response = array ( 'textTitle' => $ textTitle , 'textMessage' => $ textMessage , 'success' => $ success ) ; $ this -> getEventManager ( ) -> trigger ( 'meliscore_language_update_end' , $ this , $ response ) ; return new JsonModel ( $ response ) ; }
This allows the selected language to get new translations from melisplatform

@return \Zend\View\Model\JsonModel
This allows the selected language to get new translations from melisplatform