Skip to content

Instantly share code, notes, and snippets.

@dirkjanfaber
Last active May 31, 2021 08:31
Show Gist options
  • Save dirkjanfaber/869b251e3fffcb19a53fa2c3fb8a8d5c to your computer and use it in GitHub Desktop.
Save dirkjanfaber/869b251e3fffcb19a53fa2c3fb8a8d5c to your computer and use it in GitHub Desktop.
POEditor download and convert file for Venus OS gui
#!/bin/bash
# language is first parameter, defaulting to 'nl' if none given
lang=${1:-nl}
# Add Qt to the path
PATH=$PATH:~/Qt/5.13.2/gcc_64/bin/
# export .po file. First query gives us a file location
po_file_location=$(curl -X POST https://api.poeditor.com/v2/projects/export \
-d api_token="${POEDITOR_TOKEN}" \
-d id="436533" \
-d language="${lang}" \
-d type="po" | jq --raw-output '.result.url')
# Download the actual file
curl -o color_control_${lang}.po ${po_file_location}
# Add the header on line 7
sed -i '7i\"X-Qt-Contexts: true\\n"' color_control_${lang}.po
# convert the file to .ts
lconvert -o color_control_${lang}.ts color_control_${lang}.po
# convert the file to .qm
lrelease color_control_${lang}.ts
# upload the file to the Victron device
scp color_control_${lang}.qm root@venus.local:/opt/victronenergy/gui/lang/
@dirkjanfaber
Copy link
Author

Make sure to set POEDITOR_TOKEN first before calling the script (export POEDITOR_TOKEN=....yourtoken---) and check the Qt path. This script requires, apart from default installed files, jq (sudo apt install jq) and an installation of Qt, containing lconvert and lrelease. Download that from https://qt.io.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment