compile_translations.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/bash
  2. # GNU MediaGoblin -- federated, autonomous media hosting
  3. # Copyright (C) 2015 GNU MediaGoblin contributors. See AUTHORS.
  4. #
  5. # This program is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU Affero General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU Affero General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU Affero General Public License
  16. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. # exit if anything fails
  18. set -e
  19. if [ -f "./bin/pybabel" ]; then
  20. PYBABEL="./bin/pybabel";
  21. else
  22. PYBABEL=pybabel;
  23. fi
  24. ## This used to be a lot simpler...
  25. ##
  26. ## But now we have a Lojban translation that we can't compile
  27. ## currently. We don't want to get rid of it because we want it... see
  28. ## https://issues.mediagoblin.org/ticket/1070
  29. ## to track progress.
  30. for file in `find mediagoblin/i18n/ -name "*.po"`; do
  31. if [ "$file" != "mediagoblin/i18n/jbo/mediagoblin.po" ] && \
  32. [ "$file" != "mediagoblin/i18n/templates/en/mediagoblin.po" ]; then
  33. mkdir -p `dirname $file`/LC_MESSAGES/;
  34. $PYBABEL compile -i $file \
  35. -o `dirname $file`/LC_MESSAGES/mediagoblin.mo \
  36. -l `echo $file | awk -F / '{ print $3 }'`;
  37. else
  38. echo "Skipping $file which pybabel can't compile :(";
  39. fi;
  40. done