使用 Fastlane Spaceship Tunes 可以为现有应用创建新语言吗?
Using the Fastlane Spaceship Tunes can I create a new language for existing app?
我想使用 iTunes Connect 的 Fastlane Spaceship 库 API 创建一种新语言。例如,我已经有一个可编辑的新版本,并将英语 (U.S.) 语言设置为主要语言,我想添加法语。我可以通过编程方式执行此操作还是必须使用 Apple 的 UI?
查看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)
我想使用 iTunes Connect 的 Fastlane Spaceship 库 API 创建一种新语言。例如,我已经有一个可编辑的新版本,并将英语 (U.S.) 语言设置为主要语言,我想添加法语。我可以通过编程方式执行此操作还是必须使用 Apple 的 UI?
查看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)