如何在 Cocoa 中获取 NSLocale 的显示名称?

发布于 2024-10-10 12:33:50 字数 136 浏览 0 评论 0原文

我有以下问题:

我有一个 NSLocale 对象,并且想要访问该语言环境的 .lproj 目录中的资源。 为此,我需要区域设置的全名,例如“德语”。我找不到从 NSLocale 对象获取此字符串的方法。

我该如何实现这个目标?

I have the following problem:

I have a NSLocale object and want to access a resource in a .lproj directory for this locale.
For this to work I need to full name of the locale, for example "German". I can't find a way to get this string from a NSLocale object.

How do I accomplish this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不爱素颜 2024-10-17 12:33:50

没关系:

NSLocale *locale = [[[NSLocale alloc] initWithLocaleIdentifier:language] autorelease];
[locale displayNameForKey:NSLocaleIdentifier value:language]);

Nevermind:

NSLocale *locale = [[[NSLocale alloc] initWithLocaleIdentifier:language] autorelease];
[locale displayNameForKey:NSLocaleIdentifier value:language]);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文