本地化核心数据名称 [英] Localized Core Data names

查看:245
本文介绍了本地化核心数据名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

给定应用程序包中 NSManagedObject 和Model.strings文件的Property属性的名称,如何检索该属性的本地化名称?



其他详细信息:
当我尝试访问localizationDictionary时,如下所示,该对象为nil。我在Snow Leopard,所以文档的警告,它可能返回nil,直到使用不应用。

  NSString * localized = [[managedObjectModel localizationDictionary] 
objectForKey:@Property / thePropertyName];

更新2/25/2012(差不多一年后) p>

我认为这是一个在雪豹(或至少那个特定的版本)的错误。

解决方案

您分享的链接告诉您如何访问本地化属性名称:

  NSString * localizedPropertyName = [[managedObjectModel localizationDictionary] objectForKey:@Property / thePropertyName]; 


Given the name of a Property attribute of an NSManagedObject and a Model.strings file in the application bundle, how do you retrieve the property's localized name?

Additional Details: When I try to access the localizationDictionary, as below, that object is nil. I'm in Snow Leopard, so the documentation's warning that it may return nil until used should not apply.

NSString *localized = [[managedObjectModel localizationDictionary]
                       objectForKey:@"Property/thePropertyName"];

Update 2/25/2012 (almost a year later)

I think this turned out to be a bug in Snow Leopard (or at least that particular version). Now, a year later and running Lion, the code above works).

解决方案

The link you shared tells you how to access the localized property name:

NSString *localizedPropertyName = [[managedObjectModel localizationDictionary] objectForKey:@"Property/thePropertyName"];

这篇关于本地化核心数据名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆