aboutsummaryrefslogblamecommitdiff
path: root/scripts/apply-translations.sh
blob: 8c9a6f56450b7a20bd5fafb5a2c556e62575e3ca (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11




                                   
                                                                                                             




                                                                                                          
                                                                                      

    
#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
cd ../

for f in $(git ls-files | grep -E '.(md|slides)$' | grep -v '^vendor/reveal.js$' | grep -v '^templates/'); do
  l="$(grep '^lang: ..$' "$f" | awk '{print $2}')"
  if [[ "$l" != 'en' ]]; then
    ref="$(grep '^ref: ' "$f" | awk '{print $2}')"
    # shellcheck disable=2046
    FROM=$(find $(find . -name '*.md' -exec grep -l "^ref: $ref$" {} \;) -exec grep -l '^lang: en$' {} \;)
    po2md "$FROM" --pofiles "locale/$l/LC_MESSAGES/${FROM%.md}.po" --quiet --save "$f"
  fi
done