PrestaShop / PrestaShop/TranslationToolsBundle

Function flattenFiles in making problems

Open
#78 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
5
Forks
21
PR merge metrics
No merged PRs in 30d

Description

Could you please add verification code to verify if locale code is not yet present in filename??

something like this is working form me:

  public static function flattenFiles($files, $outputPath, $locale, $filesystem, $addLocale = true)
    {
        foreach ($files as $file) {
            $flatName = preg_replace('#[\/\\\]#', '', $file->getRelativePath()).$file->getFilename();

            if ($addLocale) {
                if(!in_array($locale, explode('.', $flatName))){
                    $flatName = preg_replace('#\.xlf#', '.'.$locale.'.xlf', $flatName);
                }
            }

            $filesystem->copy($file->getRealpath(), $outputPath.'/'.$flatName);
        }
        return true;
    }

this is about function in this path: /Translation/Extractor/Util/Flattenizer.php
I hope I'm clear in this explanation if not please let me know.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Open Translation/Extractor/Util/Flattenizer.php and inspect the flattenFiles function, especially how $flatName is built when $addLocale is enabled. Verify the locale check against filenames and confirm that flattening adds the locale only when it is not already present.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
localization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.