Jump to content

Admin Theme Translations Error - Prestashop 1.7.1.2


onacadrianro

Recommended Posts

Admin panel -> International -> Translations -> Type of translation: Theme translations

 

Error message is attached.

 

This was reproduced on multiple terminals. 

 

To solve this, i changed the following files (this is a quick fix only):

 

- vendor\symfony\symfony\src\Symfony\Component\Finder\Finder.php

public function in($dirs)
    {
        $resolvedDirs = array();
        $mode = 0777;
 
        foreach ((array) $dirs as $dir) {
            if (is_dir($dir)) {
                $resolvedDirs[] = $dir;
            } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
                $resolvedDirs = array_merge($resolvedDirs, $glob);
            } elseif (mkdir($dir, $mode, true) ) {
                $resolvedDirs[] = $dir;
            } else {
                throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
            }
        }
 
        $this->dirs = array_merge($this->dirs, $resolvedDirs);
 
        return $this;
    }
 
- src\PrestaShopBundle\Translation\Provider\TranslationFinderTrait.php
public function getCatalogueFromPaths($paths, $locale, $pattern = null)
    {
        $messageCatalogue = new MessageCatalogue($locale);
        $xliffFileLoader = new XliffFileLoader();
        $finder = new Finder();
 
        if (null !== $pattern) {
            $finder->name($pattern);
        }
 
        $translationFiles = $finder->files()->notName('index.php')->in($paths);
//        if (count($translationFiles) === 0) {
//            throw new \Exception('There is no translation file available.');
//        }
 
        foreach ($translationFiles as $file) {
            if (strpos($file->getBasename('.xlf'), $locale) !== false) {
                $domain = $file->getBasename('.xlf');
            } else {
                $domain = $file->getBasename('.xlf').'.'.$locale;
            }
 
            $fileCatalogue = $xliffFileLoader->load($file->getPathname(), $locale, $domain);
            $messageCatalogue->addCatalogue($fileCatalogue);
        }
 
        return $messageCatalogue;
    }

 

post-1366380-0-82799800-1500975601_thumb.jpg

Link to comment
Share on other sites

  • 5 weeks later...
  • 1 month later...
  • 2 weeks later...
  • 3 weeks later...
  • 4 months later...
  • 3 months later...

I know this topic has been covered a year ago, but I'd like to ask exactly where to extract which files? I tried everything, but my template still can not be translated. What does 2x mean? I would be very happy if someone could help me. Many Thanks!

Link to comment
Share on other sites

Hello everybody,
I have now solved it by activating the default template and deleting the template with the translation problem.
Then I uploaded the template with the translation problem again and activated and I was able to do the translations again and everything worked out.
I hope that will help you.
best regards

Link to comment
Share on other sites

On 30/6/2018 at 5:25 PM, Fijala said:

Hello everybody,
I have now solved it by activating the default template and deleting the template with the translation problem.
Then I uploaded the template with the translation problem again and activated and I was able to do the translations again and everything worked out.
I hope that will help you.
best regards

My problem is with the default template, classic on 1.7... :S

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...