问题描述
我将Asihttprequest用于我的HTTP请求,并且我的应用将处理3种语言:阿拉伯语,法语和英语,但Asihttprequest错误localizedDescription始终返回英语描述.Asihttprequest请求使用默认的ios系统本地化描述吗?如果是,我如何定位错误?谢谢.
im using Asihttprequest for my HTTP request, and my app will handel 3 language : arabic, french and english but Asihttprequest error localizedDescription return always an english description.is Asihttprequest request use the default ios systeme localisation description? if yes how can i localize error ?thank you.
推荐答案
我不确定您到底要求什么,但是您可以尝试一下.
I am not sure of what exactly you asked for, but you can try this.
在ASIHttpRequest.m文件的Initialize
方法中,使用NSLocalizedString(@"REQUESTTIMEOUT_KEY", @"The request timed out")
而不是@"The request timed out"
.
In the ASIHttpRequest.m file Initialize
method use NSLocalizedString(@"REQUESTTIMEOUT_KEY", @"The request timed out")
instead of @"The request timed out"
.
在相应的localizable.strings文件中具有"REQUESTTIMEOUT_KEY" = "EngVersion:The request timed out";
.
Have the "REQUESTTIMEOUT_KEY" = "EngVersion:The request timed out";
in the corresponding localizable.strings file.
示例代码:
ASIRequestTimedOutError = [[NSError alloc] initWithDomain:NetworkRequestErrorDomain code:ASIRequestTimedOutErrorType userInfo:[NSDictionary dictionaryWithObjectsAndKeys:NSLocalizedString(@"REQUESTTIMEOUT_KEY", @"The request timed out"),NSLocalizedDescriptionKey,nil]];
这篇关于Asihttprequest localizedDescription始终为英文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!