stride-docs
stride-docs copied to clipboard
Bug: Multi language support
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."
}