ios - Swift本地化StringWithFormat数字输出而不是Text
问题描述
目前我正在为我的应用程序进行本地化。当我想注销用户时,我想在警报中告诉他的名字。所以我使用了以下代码:
let name = "Matthias Kremer"
let formatedString = NSLocalizedString("logoutTitleWithName", comment: " abmelden?")
print( String.localizedStringWithFormat(formatedString, name))
Localizable.string 文件如下所示:
"logoutTitleWithName" = "%d abmelden";
我应该得到以下出口:
马蒂亚斯·克雷默·阿梅尔登
但相反它是
281,600 阿梅尔登
它看起来像是字符串以某种方式转换为数字。有谁知道如何处理这个?
解决方案
改变
"logoutTitleWithName" = "%@ abmelden";
%d是十进制值的替换,而%@是字符串
推荐阅读
- javascript - MateiralizeCSS Timepicker:如何使用 momentJS 找到两个时间选择器之间的时间差,在 AM/PM 之前有一个空格?
- c++ - c++ - Red-Black Tree 的重载 [] 运算符
- html - 如何显示列表
使用AngularJS获取api的html页面中的图像 - python - Matplotlib:如何更改双条形图的 figsize
- c# - LINQ AsParallel() 是否保持线程安全?
- social - 在 Sitefinity 中添加 WhatsApp 社交分享
- java - 我一直在使用 cxf 3.0.16 版本的 jar 供休息服务使用,但是在迁移到 3.2.4 之后。创建服务 bean 时出错
- android - 使用 Jsoup 在网站中提交搜索
- video-streaming - rtsp restream 上的 GStreamer 文本覆盖
- javascript - 分组复选框 - jQuery / JS / ASP.NET