Advertisement
anon_user_007

CK3 fake translation

Feb 9th, 2024 (edited)
264
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <#
  2. Instead of a ".bat" file, wrote a PowerShell script.
  3. Checks all loaded mods for the presence of the required localization. If localization is missing, it runs "copy_on_other_languages.exe".
  4. !!! You need to create a separate mod in the Paradox launcher, name it as you like. I named mine "FAKE_RUS".
  5. All localizations created during the process will be copied there.
  6. #>
  7.  
  8. # Path to the "copy_on_other_languages.exe" executable file
  9. $AppPath = "E:\mods\Cursader Kings 3\tools\copy_on_other_languages_1_0_2_windows\dist\copy_on_other_languages.exe"
  10. # Path to the mod folders
  11. $ModsFolder = "E:\Games\SteamLibrary\steamapps\workshop\content\1158310"
  12. # Path to your mod with localizations
  13. $FakeLocFolder = "D:\Norton\Documents\Paradox Interactive\Crusader Kings III\mod\FAKE_RUS\localization"
  14. # Original language
  15. $SourceLanguage = "english"
  16. # Your language
  17. $Targetlanguage = "russian"
  18.  
  19. # Variable to track the copying of the "SourceLanguage" folder
  20. $CopyVar = $false
  21.  
  22. # Get a list of subfolders in $ModsFolder
  23. $ModsFolder = Get-ChildItem -Path $ModsFolder -Directory
  24.  
  25. foreach ($ModFolder in $ModsFolder) {
  26.     Write-Host ""
  27.     # Form the path to the "localization" folder in each mod
  28.     $LocalizationFolder = Join-Path -Path $ModFolder.FullName -ChildPath "localization"
  29.     Write-Host "$LocalizationFolder" -ForegroundColor Yellow
  30.  
  31.     # Check for the presence of the "SourceLanguage" subfolder
  32.     $SourceLanguageFolder = Join-Path -Path $LocalizationFolder -ChildPath "$SourceLanguage"
  33.     if (Test-Path $SourceLanguageFolder) {
  34.         # Check for the presence of the "TargetLanguage" subfolder
  35.         $TargetLanguageFolder = Join-Path -Path $LocalizationFolder -ChildPath "$Targetlanguage"
  36.         Write-Host " $SourceLanguageFolder - exist" -ForegroundColor Green
  37.  
  38.         if (-not (Test-Path $TargetLanguageFolder)) {
  39.             Write-Host "  $TargetLanguageFolder - not exist" -ForegroundColor Red
  40.             # Copy the "SourceLanguageFolder" folder to $FakeLocFolder
  41.             Write-Host "  Copy..."
  42.             Copy-Item -Path $SourceLanguageFolder -Destination $FakeLocFolder -Recurse -Force
  43.             $CopyVar = $true
  44.         } else {
  45.             Write-Host "  $TargetLanguageFolder - exist" -ForegroundColor Green
  46.         }
  47.     } else {
  48.         Write-Host " skip..." -ForegroundColor Cyan
  49.     }
  50. }
  51.  
  52. # If at least one "SourceLanguage" folder was copied
  53. if ($CopyVar) {
  54.     Write-Host ""
  55.     Write-Host "Start process... don't close this window."
  56.     # Run the "copy_on_other_languages.exe" program
  57.     Start-Process -FilePath "$AppPath" -ArgumentList `"$FakeLocFolder`", $SourceLanguage, $Targetlanguage -Wait -NoNewWindow
  58.    # Remove the "SourceLanguage" folder in $FakeLocFolder
  59.    Remove-Item -Path (Join-Path -Path $FakeLocFolder -ChildPath "$SourceLanguage") -Recurse -Force
  60. }
  61.  
  62. # Operation completed
  63. Write-Host ""
  64. Write-Host ""
  65. Write-Host "Operation completed. " -NoNewline -ForegroundColor Green
  66. Read-Host "Press Enter to exit"
  67.  
Tags: CK3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement