Last active
May 31, 2021 08:31
-
-
Save dirkjanfaber/869b251e3fffcb19a53fa2c3fb8a8d5c to your computer and use it in GitHub Desktop.
POEditor download and convert file for Venus OS gui
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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, containinglconvert
andlrelease
. Download that from https://qt.io.