addMockDevice.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. cd scripts/screenshots/
  3. for i in $(find ../../fastlane | grep png | grep Screenshots) ; 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. "de-DE")
  13. locale="-de-rDE"
  14. ;;
  15. "es-MX")
  16. locale="-es-rMX"
  17. ;;
  18. "hu-HU")
  19. locale="-hu-rHU"
  20. ;;
  21. "ka-GE")
  22. locale="-ka-rGE"
  23. ;;
  24. "no-NO")
  25. locale="-nb-rNO"
  26. ;;
  27. "pt-BR")
  28. locale="-pt-rBR"
  29. ;;
  30. *)
  31. locale="-"$(echo $locale | cut -d"-" -f1)
  32. esac
  33. if [ -e ../../src/main/res/values$locale/strings.xml ] ; then
  34. text=$(grep $textID ../../src/main/res/values$locale/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
  35. else
  36. text=""
  37. fi
  38. # fallback to english if there is not translation
  39. if [ -z "$text" ]; then
  40. text=$(grep $textID ../../src/main/res/values/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
  41. fi
  42. sed "s#{image}#$i#;s#{text}#$text#g" $device.svg > temp.svg
  43. if [ $textID == "06_davdroid" ] ; then
  44. sed "s#display:none#display:visible#" -i temp.svg
  45. fi
  46. inkscape temp.svg -h 576 -e $i 2>/dev/null
  47. done