update_localization.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/zsh
  2. set -ev
  3. SRCROOT=`pwd`
  4. PODS_ROOT='Pods'
  5. echo ${SRCROOT}
  6. # Task 1
  7. # here we use the template source as input to
  8. # generate strings so we could use new strings
  9. # before sync to Crowdin
  10. # clean Base.lproj
  11. rm -rf ${SRCROOT}/Localization/StringsConvertor/input/Base.lproj
  12. # copy tempate sources
  13. mkdir ${SRCROOT}/Localization/StringsConvertor/input/Base.lproj
  14. cp ${SRCROOT}/Localization/app.json ${SRCROOT}/Localization/StringsConvertor/input/Base.lproj/app.json
  15. cp ${SRCROOT}/Localization/ios-infoPlist.json ${SRCROOT}/Localization/StringsConvertor/input/Base.lproj/ios-infoPlist.json
  16. cp ${SRCROOT}/Localization/Localizable.stringsdict ${SRCROOT}/Localization/StringsConvertor/input/Base.lproj/Localizable.stringsdict
  17. # Task 2 generate strings file
  18. cd ${SRCROOT}/Localization/StringsConvertor
  19. sh ./scripts/build.sh
  20. # Task 3 copy strings file
  21. cp -R ${SRCROOT}/Localization/StringsConvertor/output/main/ ${SRCROOT}/Mastodon/Resources
  22. cp -R ${SRCROOT}/Localization/StringsConvertor/output/module/ ${SRCROOT}/MastodonSDK/Sources/MastodonLocalization/Resources
  23. cp -R ${SRCROOT}/Localization/StringsConvertor/Intents/output/ ${SRCROOT}/MastodonIntent
  24. # Task 4 swiftgen
  25. cd ${SRCROOT}
  26. echo "${PODS_ROOT}/SwiftGen/bin/swiftgen"
  27. if [[ -f "${PODS_ROOT}/SwiftGen/bin/swiftgen" ]] then
  28. "${PODS_ROOT}/SwiftGen/bin/swiftgen"
  29. else
  30. echo "Run 'bundle exec pod install' or update your CocoaPods installation."
  31. fi
  32. # Task 5 clean temp file
  33. rm -rf ${SRCROOT}/Localization/StringsConvertor/output
  34. rm -rf ${SRCROOT}/Localization/StringsConvertor/intents/output