xcode iOS获取所有本地化的列表 [英] xcode iOS getting a list of all localizations

查看:107
本文介绍了xcode iOS获取所有本地化的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取所有可用本地化的列表?

How do I get a list of all available localizations?

我有一个包含五个本地化的应用程序。我需要知道当前的语言环境是否在该列表中,如果没有,则创建一个回退。
但是如何确定当前区域设置是否在该列表中?

I have an app with five localizations. I need to know whether the current locale is in that list and if not, create a fallback. But how do I find out if the current locale is in that list?

推荐答案

查找最简单的方法如果支持或不支持当前语言环境,则将向您添加的所有五个本地化版本中添加一个特殊的test字符串(例如, @IsSupported= @是)支持。然后一个简单的检查将起作用:

The simplest way to find out if the current locale is supported or not would be to add a special "test" string (say, @"IsSupported" = @"Yes") to all five localizations that you support. Then a simple check will work:

BOOL supported = [NSLocalizedString(@"IsSupported", nil) isEqualToString:@"Yes"];

这篇关于xcode iOS获取所有本地化的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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