0

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

4

1 回答 1

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)
于 2016-03-10T02:12:26.570 回答