Files
mpv.net/lang/create-mo-files.ps1
2024-07-15 06:39:02 +02:00

27 lines
584 B
PowerShell

$ErrorActionPreference = 'Stop'
$PoFiles = Get-ChildItem $PSScriptRoot/po
$ExeFolder = "$PSScriptRoot/../src/MpvNet.Windows/bin/Debug"
foreach ($it in $PoFiles)
{
$folder = "$ExeFolder/Locale/$($it.BaseName)/LC_MESSAGES"
if (-not (Test-Path $folder))
{
New-Item -ItemType Directory -Path $folder | Out-Null
}
$moPath = "$folder/mpvnet.mo"
if (-not (Test-Path $moPath))
{
New-Item -ItemType File -Path $moPath | Out-Null
}
msgfmt --output-file=$moPath $it.FullName
if ($LastExitCode) { throw $LastExitCode }
$moPath
}