lib/LocalizationSmartcat.rb in pixab-1.7.3 vs lib/LocalizationSmartcat.rb in pixab-1.7.5
- old
+ new
@@ -14,11 +14,11 @@
Localization_FILE_NAME = 'Localization.zip'
Project_AirBrush = '6cd2db15-6325-43ae-9087-f78aca9bec9a'
Project_AirBrushVideo = '16cbeffd-bb6e-46e8-a32e-9c79d23a796f'
- attr_accessor :projects, :tags, :platform, :collections
+ attr_accessor :projects, :tags, :platform, :collections, :languages
def initialize()
@projects = Project_AirBrush
@collections = 'main'
end
@@ -29,14 +29,16 @@
case command
when '--ab-android'
@platform = 'android'
@tags = 'android'
@collections = 'AirBrush'
+ @languages = 'en,ru,tr,de,fr,zh-Hans,zh-Hant,pt-BR,es,ar'
when '--ab-iOS'
@platform = 'iOS'
@tags = 'iOS'
@collections = 'AirBrush'
+ @languages = 'en,ru,tr,de,fr,zh-Hans,zh-Hant,pt-BR,es,ar'
when '--abv-iOS'
@projects = Project_AirBrushVideo
@platform = 'iOS'
@tags = 'iOS'
when '--abv-android'
@@ -55,10 +57,12 @@
@tags = commands[index + 1]
when '--platform'
@platform = commands[index + 1]
when '--collections'
@collections = commands[index + 1]
+ when '--languages'
+ @languages = commands[index + 1]
end
end
export_url = "https://smartcat.com/api/integration/v2/project/#{projects}/export"
export_params = generate_export_params
@@ -113,11 +117,11 @@
# 等待1秒后重试
sleep 1
end
end
- puts "Failed to download after #{max_retries} retries. Export ID: #{export_id}"
+ puts "\nFailed to download after #{max_retries} retries. Export ID: #{export_id}"
return false
end
# 第三步:解压缩ZIP文件
def unzip_file(zip_path)
@@ -174,9 +178,13 @@
'collections' => collections,
'completion-state' => 'final',
'fallback-to-default-language' => nil,
'include-default-language' => nil,
}
+
+ unless languages.nil?
+ export_params['languages'] = languages
+ end
if !platform.nil?
format = nil
template = nil
if platform == 'android'
\ No newline at end of file