使用Fastlane Spaceship Tunes我可以为现有应用创建一种新语言吗?

时间:2016-03-10 01:31:01

标签: fastlane

我想使用Fastlane Spaceship库为iTunes Connect API创建一种新语言。例如,我已经有一个可编辑的新版本并且将英语(美国)语言设置为主要版本,我想添加语言French。我可以通过编程方式执行此操作,还是必须使用Apple的UI?

1 个答案:

答案 0 :(得分:1)

查看deliver的代码,您可以执行以下操作:

# Makes sure all languages we need are actually created
def verify_available_languages!(options)
  # Collect all languages we need
  # We only care about languages from user provided values
  # as the other languages are on iTC already anyway
  v = options[:app].edit_version
  UI.user_error!("Could not find a version to edit for app '#{options[:app].name}', the app metadata is read-only currently") unless v

  enabled_languages = []
  LOCALISED_VERSION_VALUES.each do |key|
    current = options[key]
    next unless current && current.kind_of?(Hash)
    current.each do |language, value|
      enabled_languages << language unless enabled_languages.include?(language)
    end
  end

  if enabled_languages.count > 0
    v.create_languages(enabled_languages)
    lng_text = "language"
    lng_text += "s" if enabled_languages.count != 1
    UI.message("Activating #{lng_text} #{enabled_languages.join(', ')}...")
    v.save!
  end
  true
end

所以基本上使用这种方法来创建一种新语言:

v.create_languages(enabled_languages)