addMockDevice.sh 972 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/sh
  2. cd scripts/screenshots/
  3. for i in $(find ../../fastlane | grep png) ; do
  4. device=$(echo $i | cut -d"/" -f8 | sed s'#Screenshots##')
  5. textID=$(echo $i | cut -d"/" -f9 | cut -d"_" -f1,2)
  6. locale=$(echo $i | cut -d"/" -f6)
  7. # handle some locales different
  8. case $locale in
  9. "en-US")
  10. locale=""
  11. ;;
  12. *)
  13. locale="-"+$locale
  14. esac
  15. text=$(grep $textID ../../src/main/res/values$locale/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
  16. # fallback to english if there is not translation
  17. if [ $text == "" ]; then
  18. text=$(grep $textID ../../src/main/res/values/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
  19. fi
  20. sed "s#{image}#$i#;s#{text}#$text#g" $device.svg > temp.svg
  21. if [ $textID == "06_davdroid" ] ; then
  22. sed "s#display:none#display:visible#" -i temp.svg
  23. fi
  24. inkscape temp.svg -e $i
  25. done