addMockDevice.sh 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #!/bin/bash
  2. # SPDX-FileCopyrightText: 2017-2024 Nextcloud GmbH and Nextcloud contributors
  3. # SPDX-FileCopyrightText: 2017-2018-2024 Tobias Kaminsky <tobias@kaminsky.me>
  4. # SPDX-License-Identifier: AGPL-3.0-or-later OR GPL-2.0-only
  5. cd scripts/screenshots/
  6. for i in $(find ../../fastlane | grep png | grep Screenshots) ; do
  7. device=$(echo $i | cut -d"/" -f8 | sed s'#Screenshots##')
  8. textID=$(echo $i | cut -d"/" -f9 | cut -d"_" -f1,2)
  9. locale=$(echo $i | cut -d"/" -f6)
  10. # handle some locales different
  11. case $locale in
  12. "en-US")
  13. locale=""
  14. ;;
  15. "en-GB")
  16. locale="-b+en+001"
  17. ;;
  18. "de-DE")
  19. locale="-de"
  20. ;;
  21. "es-MX")
  22. locale="-es-rMX"
  23. ;;
  24. "hu-HU")
  25. locale="-hu-rHU"
  26. ;;
  27. "ka-GE")
  28. locale="-ka-rGE"
  29. ;;
  30. "no-NO")
  31. locale="-nb-rNO"
  32. ;;
  33. "pt-BR")
  34. locale="-pt-rBR"
  35. ;;
  36. "pt-PT")
  37. locale="-pt-rPT"
  38. ;;
  39. "bg-BG")
  40. locale="-bg-rBG"
  41. ;;
  42. "fi-FI")
  43. locale="-fi-rFI"
  44. ;;
  45. "uk-UK")
  46. locale=""
  47. ;;
  48. "ja-JP")
  49. locale="-ja-rJP"
  50. ;;
  51. "lt-LT")
  52. locale="-lt-rLT"
  53. ;;
  54. "zh-HK")
  55. locale="-zh-rCN"
  56. ;;
  57. "zk-CN")
  58. locale="-zh-rCN"
  59. ;;
  60. "id-ID")
  61. locale="-in"
  62. ;;
  63. "cs-CZ")
  64. locale="-cs-rCZ"
  65. ;;
  66. *)
  67. locale="-"$(echo $locale | cut -d"-" -f1)
  68. esac
  69. if [ -e ../../app/src/main/res/values$locale/strings.xml ] ; then
  70. heading=$(grep $textID"_heading" ../../app/src/main/res/values$locale/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
  71. subline=$(grep $textID"_subline" ../../app/src/main/res/values$locale/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
  72. else
  73. heading=""
  74. subline=""
  75. fi
  76. # fallback to english if there is not translation
  77. if [ -z "$heading" ]; then
  78. heading=$(grep $textID"_heading" ../../app/src/main/res/values/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
  79. fi
  80. if [ -z "$subline" ]; then
  81. subline=$(grep $textID"_subline" ../../app/src/main/res/values/strings.xml | cut -d">" -f2 | cut -d"<" -f1 | sed s'#\&amp;#\\&#')
  82. fi
  83. sed "s#{image}#$i#;s#{heading}#$heading#;s#{subline}#$subline#g" $device.svg > temp.svg
  84. if [ $textID == "06_davdroid" ] ; then
  85. sed "s#display:none#display:visible#" -i temp.svg
  86. fi
  87. inkscape temp.svg -h 576 -e $i 2>/dev/null
  88. done