Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Multi language support #289

Open
VaclavElias opened this issue May 5, 2024 · 0 comments
Open

Bug: Multi language support #289

VaclavElias opened this issue May 5, 2024 · 0 comments
Labels
ci-cd site-generator Static site generator

Comments

@VaclavElias
Copy link
Contributor

At the time we created BuildDocs.ps1 only manual folder was translated to JP and so all PowerShell code logic was about copying translated files from the manual\*.md folder + index.md.

function Build-NonEnglishDoc needs to be updated:

  • Now that we have multiple folders we should update the logic. It might be enough just copy everything from jp folder to the _temp folder
  • $files = Get-ChildItem "$langFolder/$($Settings.ManualFolderName)/*.md" -Recurse -Force probably, we need to make an array where we list folders to process, which are all folders except: template, example, includes folder.

So this below should be probably in the loop, processing selected folders [manual, tutorials,community-resources,..] or one loop and $files should contain all those files from listed folders for marking.

        # Get all previously copied en files from the selected language folder
        $files = Get-ChildItem "$langFolder/$($Settings.ManualFolderName)/*.md" -Recurse -Force

        Write-Host "Start write files:"

        # Mark files as not translated if they are not a toc.md file
        foreach ($file in $files)
        {
            if($file.ToString().Contains("toc.md")) {
                continue;
            }

            $data = Get-Content $file -Encoding UTF8
            for ($i = 0; $i -lt $data.Length; $i++)
            {
                $line = $data[$i];
                if ($line.length -le 0)
                {
                    Write-Host $file

                    $data[$i]="> [!WARNING]`r`n> " + $SelectedLanguage.NotTranslatedMessage + "`r`n"

                    $data | Out-File -Encoding UTF8 $file

                    break
                }
            }
        }

This part probably just need to copy everything from jp folder instead doing it individually.

$indexFile = $Settings.IndexFileName

        # overwrite en manual page with translated manual page
        if (Test-Path ($SelectedLanguage.Code + "/" + $indexFile)) {
            Copy-Item ($SelectedLanguage.Code + "/" + $indexFile) $langFolder -Force
        }
        else {
            Write-Warning "$($SelectedLanguage.Code)/"+ $indexFile +" not found. English version will be used."
        }

        # overwrite en manual pages with translated manual pages
        if (Test-Path ($SelectedLanguage.Code + "/" + $Settings.ManualFolderName)) {
            Copy-Item ($SelectedLanguage.Code + "/" + $Settings.ManualFolderName) -Recurse -Destination $langFolder -Force
        }
        else {
            Write-Warning "$($SelectedLanguage.Code)/$($Settings.ManualFolderName) not found."
        }
@VaclavElias VaclavElias added site-generator Static site generator ci-cd labels May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci-cd site-generator Static site generator
Projects
None yet
Development

No branches or pull requests

1 participant