compile_translations.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  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 several translations 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. ##
  31. ## List of uncompilable translations: Lojban (jbo), Interlingua (ia)
  32. for file in `find mediagoblin/i18n/ -name "*.po"`; do
  33. if [ "$file" != "mediagoblin/i18n/jbo/mediagoblin.po" ] && \
  34. [ "$file" != "mediagoblin/i18n/ia/mediagoblin.po" ] && \
  35. [ "$file" != "mediagoblin/i18n/templates/en/mediagoblin.po" ]; then
  36. mkdir -p `dirname $file`/LC_MESSAGES/;
  37. $PYBABEL compile -i $file \
  38. -o `dirname $file`/LC_MESSAGES/mediagoblin.mo \
  39. -l `echo $file | awk -F / '{ print $3 }'`;
  40. else
  41. echo "Skipping $file which pybabel can't compile :(";
  42. fi;
  43. done