stride3d / stride3d/stride-docs

Bug: Multi language support

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

Nobody has claimed this yet.

ci-cd site-generator
Dominant language
PowerShell
Stars
39
Forks
74
Avg merge
3h 36m
Merged PRs (30d)
2

Description

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

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

Start in BuildDocs.ps1 at Build-NonEnglishDoc and trace how the selected language folder is copied and scanned. Update the logic to process translated folders other than template, example, and includes, while preserving the toc.md and untranslated-warning behavior; the documentation build should use all applicable translated content and retain the English fallback when files are absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
build-system, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.