Skip to content

Compile the UI translation files

书伴 edited this page Apr 7, 2024 · 1 revision

Here are some scripts for compiling .po files to .mo files. Please replace the /path/to/project with the real plugin project path.

PowerShell script on Windows

$project_path = "/path/to/project"

Set-Location $project_path

Get-ChildItem -Filter *.po | ForEach-Object {
    $poFile = $_.FullName
    $moFile = $_.BaseName + '.mo'
    msgfmt -o $moFile $poFile
}

Bash script on macOS/Linux

#!/bin/bash

project_path=/path/to/project

for i in $(ls $project_path/translations/*.po); do
    name=${i##*/}
    echo "$name => ${name/%po/mo}"
    msgfmt $i -o ${i%.*}.mo
done

You can also use other translation editors such as Poedit to compile .po file to .mo file.