#!/bin/sh                                                                                                                                             
 
set -e
set -u
 
UPDATE_LANGS="ar ca de es fa fr it pl pt sr_Latn tr ru zh zh_TW"
 
update_memory () {
    lang=$1
    cd /var/lib/weblate/repositories/vcs/tails/index
    sudo -u weblate find wiki/src/ -name *.${lang}.po  -type f | while read po_file; do
        sudo -u weblate build_tmdb -d /var/lib/tmserver/db -s en -t ${lang} $po_file
    done
}
 
for lang in $UPDATE_LANGS  ; do update_memory $lang  ; done

