使用 FaSTLane 翻译插件进行 iOS 本地化

标签 ios swift oauth-2.0 localization fastlane

我正在尝试设置一个流程,在 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_idclient_secretrefresh_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/

相关文章:

ios - 从 Swift 数组中删除具有重复属性的对象

javascript - 客户端 Google OAuth 2.0 在 Instagram 的 WebView 中停滞不前

ios - 我不想在 CIFilter 的 CIGaussianBlur 中扩展

ios - refreshObject :mergeChanges: and set object to nil? 之间有什么不同

ios - 队列优先级似乎不对

python - 通过 python 使用 twitter 搜索 api

api - SSL:我需要保护每个端点吗

ios - HockeyApp 错误 bundle 版本不匹配

ios - 找不到框架-fobjc-arc

arrays - Swift中存放不同类对象的数组