Skip to content

Commit

Permalink
Merge pull request #580 from UnrealMultiple/script-zi18n
Browse files Browse the repository at this point in the history
fix(scripts/zi18n): mo file not generated when no updates in pot file
  • Loading branch information
ACaiCat authored Nov 23, 2024
2 parents 7382df8 + d196c26 commit d5ab772
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions scripts/zi18n.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,22 @@ function Update-I18n {
if (($d.Length -ge 2) -and ([int]$d[0] -le 2 -and [int]$d[1] -le 2)) {
git restore $pot
Write-Output "[$($p.Name)] template.pot restored!"
continue
}

if ($NoPo) {
if ($NoPo -and $NoMo) {
continue
}

foreach ($t in @(Get-ChildItem $($p.DirectoryName)i18n/*.po)) {
Write-Output "[$($p.Name)] [$($t.Name)] merging..."
msgmerge --previous --update $t.FullName $pot
if (!$NoPo) {
Write-Output "[$($p.Name)] [$($t.Name)] merging..."
msgmerge --previous --update $t.FullName $pot
}

if (!$NoMo) {
msgfmt -o $([System.IO.Path]::ChangeExtension($t.FullName, '.mo')) $t.FullName
$mo = [System.IO.Path]::ChangeExtension($t.FullName, '.mo')
Write-Output "[$($p.Name)] [$([System.IO.Path]::GetFileName($mo))] generating..."
msgfmt -o $mo $t.FullName
}
}
}
Expand Down

0 comments on commit d5ab772

Please sign in to comment.