作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
当使用这样的 DateComponentFormatter 时
let formatter = DateComponentsFormatter()
formatter.unitsStyle = .full
formatter.includesApproximationPhrase = false
formatter.includesTimeRemainingPhrase = false
formatter.allowedUnits = [.hour]
var components = DateComponents()
components.hour = 4
let outputString = formatter.string(from: components)
当我的语言/地区是英语/美国时,输出为“4 小时”。将语言/区域更改为法语/法国时,我预计输出为“4 小时”,但结果仍然为“4 小时”。关于如何让 DateComponentFormatter 进行翻译有什么建议吗?
更改手机上的语言/区域似乎没有效果。
最佳答案
可能是,您的应用未本地化为其他语言。我关注了https://www.raywenderlich.com/250-internationalizing-your-ios-app-getting-started用于在我的应用程序中添加本地化。
关于ios - DateComponentFormatter 翻译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58699622/
这个问题在这里已经有了答案: NSDateFormatter and current language in iOS11 (5 个回答) 已关闭 3 年前。 当使用这样的 DateComponentF
我是一名优秀的程序员,十分优秀!