gpt4 book ai didi

iphone - 您可以通过编程方式访问 Cocoa Touch 中的标准本地化字符串吗?

转载 作者:行者123 更新时间:2023-11-30 14:02:59 24 4
gpt4 key购买 nike

一些 iOS 控件具有 Apple 内置的本地化字符串。 “完成”、“编辑”、“返回”栏按钮项目是一些示例。有没有办法访问这些字符串?

我正在制作一个带有标准“删除”或“取消”选项的 UIActionSheet,就像您在“通讯录”应用中删除联系人时一样。

有没有办法在代码中引用这些字符串?如果没有,是否有地方至少可以获取这些字符串(例如从 Apple 应用程序的资源中提取它们)?它将节省额外的本地化工作,并确保与平台的一致性。

最佳答案

如果 iOS 就像 Mac OS 一样,每个应用程序都带有自己的 Localized.strings 文件。在每个字符串文件中,您都有所有这些小字符串,例如“完成”、“编辑”、“取消”等。

这些是我从 Finder.app 的英文 Localized.string 文件复制的一些字符串:

<key>AL1</key>
<string>Cancel</string>
<key>AL4</key>
<string>OK</string>
<key>AL9</key>
<string>Don’t Save</string>
<key>FF24</key>
<string>Save</string>
<key>U32</key>
<string>Yes</string>
<key>U33</key>
<string>No</string>

你明白了。每个小字符串都在每个应用程序中进行了本地化。

这个来自 iTunes.app。

/* ===== Ask User Strings ===== */
"23987.001" = "Yes";
"23987.002" = "No";
"23987.003" = "OK";
"23987.004" = "Cancel";
"23987.005" = "Ignore";
"23987.006" = "Quit";
"23987.007" = "Don’t Quit";
"23987.008" = "Apply";
"23987.009" = "Don’t Apply";
"23987.010" = "Later";
"23987.011" = "Don’t Save";
"23987.012" = "Save";
"23987.013" = "Stop";
"23987.014" = "Continue";
"23987.015" = "Delete";
"23987.016" = "Remove";
"23987.017" = "Replace";
"23987.018" = "Don’t Replace";
"23987.019" = "Do not ask me again";

看起来更有条理一些。但复制他们的文件可能是不允许的;-)

<小时/>

answer in apples devforum作者:Apple 开发者关系部的 Quinn (eskimo1)。

Some UI elements are automatically localised for you. For example, the artwork on a UIBarButtonItem. However, there's no supported way to get to the strings like "OK" and "Cancel" as they are used in a UIActionSheet. They should, however, be trivial for your localiser to cope with.

不过2岁了。但较新的线程具有相同的结果。没有办法得到这些字符串。

关于iphone - 您可以通过编程方式访问 Cocoa Touch 中的标准本地化字符串吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32769262/

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