gpt4 book ai didi

swift - 本地化 FirebaseUI 身份验证

转载 作者:行者123 更新时间:2023-11-30 12:35:43 24 4
gpt4 key购买 nike

我是一个快速新手,所以请耐心等待。我已成功将 FirebaseUI 集成到我的应用程序中。我现在希望将字符串本地化为荷兰语。我的整个项目都是荷兰语的,所以我在项目中没有任何本地化,因为它全部硬编码在 Storyboard中。 FirebaseUI docs说你应该:

// Swift
authUI?.customStringsBundle = NSBundle.mainBundle() // Or any custom bundle.

但我不确定在项目中实际放置字符串文件的位置(或如何放置),或者我是否应该使用自定义包?

我花了一整天的时间尝试捆绑,但没有成功。我们将不胜感激您的帮助!

最佳答案

以下是我最终让它发挥作用的方法:

  1. 添加名为 FirebaseAuthUI.strings 的字符串文件。我从here复制了这个文件的内容
  2. 创建 Controller 来处理登录时,请使用以下代码:

代码:

if let bundlePath = Bundle.main.path(forResource: "FirebaseAuthUI", ofType: "strings") {
let bundle = Bundle(path: bundlePath)
authUI?.customStringsBundle = bundle;
}

不要忘记翻译第 1 步中的字符串。

祝你好运

关于swift - 本地化 FirebaseUI 身份验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42890955/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com