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

         
 
                                                                                                     
                                                  
                           

                                                  
                                                                                                                          
                                                                                      

    
#!/bin/sh
set -eu

for f in $(git ls-files | grep -E '.(md|slides)$' | grep -Ev '^(vendor/reveal.js|TODOs.md|aux/)'); 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 . -type f -name '*.md' -exec grep -l "^ref: $ref$" {} \;) -type f -exec grep -l '^lang: en$' {} \;)
    po2md "$FROM" --pofiles "locale/$l/LC_MESSAGES/${FROM%.md}.po" --quiet --save "$f"
  fi
done