@@ -765,6 +765,79 @@ platform :ios do
765765 )
766766 end
767767
768+ desc 'Download App Store Translations'
769+ lane :download_app_store_translations do
770+ files = {
771+
772+ # Metadata fields
773+ 'app_store_desc' => { desc : 'description.txt' } ,
774+ 'app_store_keywords' => { desc : 'keywords.txt' } ,
775+ 'app_store_subtitle' => { desc : 'subtitle.txt' } ,
776+ 'app_store_promo_text' => { desc : 'promotional_text.txt' } ,
777+ 'whats_new' => { desc : 'whats_new.txt' } ,
778+
779+ # Screenshots
780+ 'app_store_screenshot-1' => { desc : 'app_store_screenshot_1.txt' } ,
781+ 'app_store_screenshot-2' => { desc : 'app_store_screenshot_2.txt' } ,
782+ 'app_store_screenshot-3' => { desc : 'app_store_screenshot_3.txt' } ,
783+ 'app_store_screenshot-4' => { desc : 'app_store_screenshot_4.txt' } ,
784+ 'app_store_screenshot-5' => { desc : 'app_store_screenshot_5.txt' }
785+ }
786+
787+ metadata_locales = GLOTPRESS_LOCALES
788+
789+ gp_downloadmetadata ( project_url : 'https://translate.wordpress.com/projects/woocommerce%2Fwoocommerce-ios%2Frelease-notes/' ,
790+ target_files : files ,
791+ locales : metadata_locales ,
792+ source_locale : 'en-US' ,
793+ download_path : './fastlane/metadata' )
794+
795+ # Ensure that localizations are present in the right places (some locale codes aren't correct)
796+ {
797+ 'ar' => 'ar-SA' ,
798+ 'de' => 'de-DE' ,
799+ 'es' => 'es-ES' ,
800+ 'fr' => 'fr-FR' ,
801+ 'nl' => 'nl-NL' ,
802+ 'zh-cn' => 'zh-Hans' ,
803+ 'zh-tw' => 'zh-Hant'
804+ } . each do |source , destination |
805+ source_dir = File . join ( Dir . pwd , 'metadata' , source )
806+ Dir . children ( source_dir ) . each do |file |
807+ source_file = File . join ( source_dir , file )
808+ destination_file = File . join ( Dir . pwd , 'metadata' , destination , file )
809+ FileUtils . mv ( source_file , destination_file )
810+ end
811+ FileUtils . remove_dir ( source_dir )
812+ end
813+
814+ # Copy source files into `en-US`
815+ enUS_path = File . join ( Dir . pwd , 'metadata' , 'en-US' )
816+
817+ FileUtils . mkdir_p ( enUS_path )
818+
819+ [
820+ 'promo_screenshot_1.txt' ,
821+ 'promo_screenshot_2.txt' ,
822+ 'promo_screenshot_3.txt' ,
823+ 'promo_screenshot_4.txt' ,
824+ 'promo_screenshot_5.txt'
825+ ] . each do |filename |
826+ source = File . join ( Dir . pwd , 'appstoreres' , 'metadata' , 'source' , filename )
827+ destination = File . join ( enUS_path , filename )
828+ FileUtils . cp ( source , destination )
829+ end
830+
831+ # Replace the `default` directory with the contents of `en-US`
832+ default_path = File . join ( Dir . pwd , 'metadata' , 'default' )
833+ FileUtils . remove_dir ( default_path ) if File . directory? ( default_path )
834+ FileUtils . copy_entry ( enUS_path , default_path )
835+
836+ # Never store review information (it contains passwords and PII)
837+ review_info_path = File . join ( Dir . pwd , 'metadata' , 'review_information' )
838+ FileUtils . remove_dir ( review_info_path ) if File . directory? ( review_info_path )
839+ end
840+
768841 desc 'Create Promo Screenshots'
769842 lane :create_promo_screenshots do |options |
770843 unless Fastlane ::Helper ::GitHelper . has_git_lfs
0 commit comments