我正在尝试设置一个流程,在 Google 文档中进行翻译并将其下载到 .strings 文件中,并生成一个 Translations swift 结构,其中包含每个 NSLocalizedString 键的常量。我被身份验证部分困住了:
安装翻译插件
fastlane add_plugin translation
在 Fastfile 中创建 channel
lane :translations do
translation(
doc_id:'PASTED_FROM_GOOGLE_DOC_URL',
key: 0,
ios_output_paths:{
'DummyProject/da.lproj/Localizable.strings' => 1,
'DummyProject/en.lproj/Localizable.strings' => 2
},
swift_struct_path: 'DummyProject/Translations.swift',
config_path: "fastlane/config.json"
)
end
config.json 文件内容
{
"client_id": "136678564448-ta8gq3t1ipcpb9n97s0gbnee1rl94l8q.apps.googleusercontent.com",
"client_secret": "_LDTyiL4u0gHmU2QoasZCBI4",
"scope": [
"https://www.googleapis.com/auth/drive",
"https://spreadsheets.google.com/feeds/"
],
"refresh_token": "1/kALA83pkHtJD1jFXnlLsQxrVKoz4KW77NFVVNTLl7d4"
}
如何获取 client_id
、client_secret
和 refresh_token
以便插件可以从 Google 文档下载翻译?
最佳答案
关注[ https://github.com/gimite/google-drive-ruby/blob/master/doc/authorization.md#on-behalf-of-you-command-line-authorization][1]获取 config.json 的 client_id、client_secret
必须创建一个项目来制作 OAuth 2.0 客户端凭据
如果 config.json
文件中省略该字段并且脚本要求您转到特殊网页,则可以首次获取刷新 token 。
关于使用 FaSTLane 翻译插件进行 iOS 本地化,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52984498/