Jump to content

Erreur lors de la traduction


Recommended Posts

Bonjour, 

quand j'essaie de traduire les emails ou alors d'autres module voici mon erreur :

Could not crawl for translation files: The "/home/customer/www/mytacos-thonon.fr/public_html/var/cache/prod/themes/at_kola/translations" directory does not exist.

Avez-vous une idée ? 

Link to comment
Share on other sites

ok merci mais je vais devoir faire cela pour chacun des modules que je vais vouloir traduire ? la je suis en train de voir avec lui si au cas ou il n'aurait pas oublié des choses.

ou installer en local pour voir si les repertoires ne se crééraient pas à ce moment la ? 

en tout cas un grand merci pour votre disponibilité

Link to comment
Share on other sites

Pour les modules c'est Prestashop qui doit les créer automatiquement lorsque l'on choisit une langue et un thème (du moins en 1.6, en 1.7 je ne veux même pas le savoir vu comme il ont modifié le truc)

    /**
     * Read the Post var and write the translation file.
     * This method overwrites the old translation file.
     *
     * @param bool $override_file Set true if this file is a override
     *
     * @throws PrestaShopException
     */
    protected function writeTranslationFile($override_file = false)
    {
        $type = Tools::toCamelCase($this->type_selected, true);

        if (isset($this->translations_informations[$this->type_selected])) {
            $translation_informations = $this->translations_informations[$this->type_selected];
        } else {
            return;
        }

        if ($override_file) {
            $file_path = $translation_informations['override']['dir'].$translation_informations['override']['file'];
        } else {
            $file_path = $translation_informations['dir'].$translation_informations['file'];
        }

        if ($file_path && !file_exists($file_path)) {
            if (!file_exists(dirname($file_path)) && !mkdir(dirname($file_path), 0777, true)) {
                throw new PrestaShopException(sprintf(Tools::displayError('Directory "%s" cannot be created'), dirname($file_path)));
            } elseif (!touch($file_path)) {
                throw new PrestaShopException(sprintf(Tools::displayError('File "%s" cannot be created'), $file_path));
            }
        }

        $thm_name = str_replace('.', '', Tools::getValue('theme'));
        $kpi_key = substr(strtoupper($thm_name.'_'.Tools::getValue('lang')), 0, 16);

        if ($fd = fopen($file_path, 'w')) {
            // Get value of button save and stay
            $save_and_stay = Tools::isSubmit('submitTranslations'.$type.'AndStay');

            // Get language
            $lang = strtolower(Tools::getValue('lang'));

            // Unset all POST which are not translations
            unset(
                $_POST['submitTranslations'.$type],
                $_POST['submitTranslations'.$type.'AndStay'],
                $_POST['lang'],
                $_POST['token'],
                $_POST['theme'],
                $_POST['type']
            );

            // Get all POST which aren't empty
            $to_insert = array();
            foreach ($_POST as $key => $value) {
                if (!empty($value)) {
                    $to_insert[$key] = $value;
                }
            }

            ConfigurationKPI::updateValue('FRONTOFFICE_TRANSLATIONS_EXPIRE', time());
            ConfigurationKPI::updateValue('TRANSLATE_TOTAL_'.$kpi_key, count($_POST));
            ConfigurationKPI::updateValue('TRANSLATE_DONE_'.$kpi_key, count($to_insert));

            // translations array is ordered by key (easy merge)
            ksort($to_insert);
            $tab = $translation_informations['var'];
            fwrite($fd, "<?php\n\nglobal \$".$tab.";\n\$".$tab." = array();\n");
            foreach ($to_insert as $key => $value) {
                fwrite($fd, '$'.$tab.'[\''.pSQL($key, true).'\'] = \''.pSQL($value, true).'\';'."\n");
            }
            fwrite($fd, "\n?>");
            fclose($fd);

            // Redirect
            if ($save_and_stay) {
                $this->redirect(true);
            } else {
                $this->redirect();
            }
        } else {
            throw new PrestaShopException(sprintf(Tools::displayError('Cannot write this file: "%s"'), $file_path));
        }
    }

 

Link to comment
Share on other sites

Donc apparement c'est une erreur de la version 1.7.6.0  qui a été corrigée dans la version 1.7.6.1 mais malheureusement c'est le site d'un client je peux pas lui dire de payer un module d'upgrade alors que l'erreur viens du CMS, avez vous une idée ? 

copier le repertoire mail est-il une bonne solution ? 

merci !

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...