cocoa编程中的区域码
任何人都可以建议替换
Regioncode xyz = (Regioncode)GetscriptmanagerVariable(smRegionCode)
吗?
问题是 GetscriptmanagerVariable()
已被弃用。
Can anyone suggest a replacement for
Regioncode xyz = (Regioncode)GetscriptmanagerVariable(smRegionCode)
?
The problem is that GetscriptmanagerVariable()
is deprecated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在寻找的功能现在位于 CFLocale。另请阅读 语言环境编程指南 和 国际化编程主题< /a>.
但您需要接受这样一个事实:这些例程不再返回
RegionCode
。相反,它们为您提供代表用户区域等的数据结构,这些数据结构可以与 Core Foundation / Cocoa 一起使用。一般来说,逐个函数、逐行替换这些 Carbon 弃用并不是一个好主意。最好将受影响的代码批量重写为 Cocoa。特别是,很少有地方需要显式使用
RegionCode
;在现代 Cocoa 应用程序中,所有这些事情都由系统透明地处理。The functionalities you're looking for is now in CFLocale. Read also Locale programming guide and Internationalization programming topics.
But you need to accept the fact that these routines don't return
RegionCode
anymore. Rather, they give you data structures which represent the user's region etc. which can be used with Core Foundation / Cocoa.In general, it's not a good idea to replace these Carbon deprecations function by function and line by line. It's better to rewrite the affected codes wholesale to Cocoa. In particular, there's very few place where you need to use
RegionCode
explicitly; in a modern Cocoa app all these things are taken care of transparently by the system.