Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- Instead of a ".bat" file, wrote a PowerShell script.
- Checks all loaded mods for the presence of the required localization. If localization is missing, it runs "copy_on_other_languages.exe".
- !!! You need to create a separate mod in the Paradox launcher, name it as you like. I named mine "FAKE_RUS".
- All localizations created during the process will be copied there.
- #>
- # Path to the "copy_on_other_languages.exe" executable file
- $AppPath = "E:\mods\Cursader Kings 3\tools\copy_on_other_languages_1_0_2_windows\dist\copy_on_other_languages.exe"
- # Path to the mod folders
- $ModsFolder = "E:\Games\SteamLibrary\steamapps\workshop\content\1158310"
- # Path to your mod with localizations
- $FakeLocFolder = "D:\Norton\Documents\Paradox Interactive\Crusader Kings III\mod\FAKE_RUS\localization"
- # Original language
- $SourceLanguage = "english"
- # Your language
- $Targetlanguage = "russian"
- # Variable to track the copying of the "SourceLanguage" folder
- $CopyVar = $false
- # Get a list of subfolders in $ModsFolder
- $ModsFolder = Get-ChildItem -Path $ModsFolder -Directory
- foreach ($ModFolder in $ModsFolder) {
- Write-Host ""
- # Form the path to the "localization" folder in each mod
- $LocalizationFolder = Join-Path -Path $ModFolder.FullName -ChildPath "localization"
- Write-Host "$LocalizationFolder" -ForegroundColor Yellow
- # Check for the presence of the "SourceLanguage" subfolder
- $SourceLanguageFolder = Join-Path -Path $LocalizationFolder -ChildPath "$SourceLanguage"
- if (Test-Path $SourceLanguageFolder) {
- # Check for the presence of the "TargetLanguage" subfolder
- $TargetLanguageFolder = Join-Path -Path $LocalizationFolder -ChildPath "$Targetlanguage"
- Write-Host " $SourceLanguageFolder - exist" -ForegroundColor Green
- if (-not (Test-Path $TargetLanguageFolder)) {
- Write-Host " $TargetLanguageFolder - not exist" -ForegroundColor Red
- # Copy the "SourceLanguageFolder" folder to $FakeLocFolder
- Write-Host " Copy..."
- Copy-Item -Path $SourceLanguageFolder -Destination $FakeLocFolder -Recurse -Force
- $CopyVar = $true
- } else {
- Write-Host " $TargetLanguageFolder - exist" -ForegroundColor Green
- }
- } else {
- Write-Host " skip..." -ForegroundColor Cyan
- }
- }
- # If at least one "SourceLanguage" folder was copied
- if ($CopyVar) {
- Write-Host ""
- Write-Host "Start process... don't close this window."
- # Run the "copy_on_other_languages.exe" program
- Start-Process -FilePath "$AppPath" -ArgumentList `"$FakeLocFolder`", $SourceLanguage, $Targetlanguage -Wait -NoNewWindow
- # Remove the "SourceLanguage" folder in $FakeLocFolder
- Remove-Item -Path (Join-Path -Path $FakeLocFolder -ChildPath "$SourceLanguage") -Recurse -Force
- }
- # Operation completed
- Write-Host ""
- Write-Host ""
- Write-Host "Operation completed. " -NoNewline -ForegroundColor Green
- Read-Host "Press Enter to exit"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement