1
A
回答
2
+(void)GetLangKey:(NSString *)Langkey
{
NSString *tmpstr=[NSString stringWithFormat:@"%@",[[NSBundle mainBundle]pathForResource:@"LanguageResources" ofType:@"bundle"]];
tmpstr =[tmpstr stringByAppendingString:@"/"];
tmpstr=[tmpstr stringByAppendingString:Langkey];
tmpstr =[tmpstr stringByAppendingString:@".lproj"];
// NSLog(@"%@",tmpstr);
myLocalizedBundle=[NSBundle bundleWithPath:tmpstr];
}
+(UIImage*)GetLocalImage:(NSString *)ImgName
{
NSString *filepath= [myLocalizedBundle pathForResource:ImgName ofType:@"png"];
UIImage *returnImg=[UIImage imageWithContentsOfFile:filepath];
return returnImg;
}
+(UIImage*)GetLocalImage:(NSString *)ImgName Type:(NSString *)imgType
{
NSString *filepath= [myLocalizedBundle pathForResource:ImgName ofType:imgType];
UIImage *returnImg=[UIImage imageWithContentsOfFile:filepath];
return returnImg;
}
+(NSString *)getLocalvalue:(NSString*)Key
{
NSString *localValue=NSLocalizedStringFromTableInBundle(Key,@"Localized",myLocalizedBundle,@"");
//NSLog(@"%@",localValue);
return localValue;
}
when you changed Language change kay
[YourAppDelegate GetLangKey:(btn_Language.selected)[email protected]"sp":@"en"];
创建两束作为字符串的文件名Sp.lproj和en.lproj 给同一个密钥对于两个字符串 获得值如下面 [YourAppDelegate的getLocalValue:@ “设置” ]。
相关问题
- 1. 应用程序支持多种语言?
- 2. Installshield多语言支持应用程序
- 3. iphone多语言支持
- 4. iphone多语言支持
- 5. 多语言支持iPhone?
- 6. Iphone中的多语言应用程序
- 7. 在Web应用程序中提供多语言支持
- 8. 在Winforms应用程序中支持多种语言
- 9. 如何在ASP.NET Web应用程序中支持多种语言?
- 10. 多语言支持科尔多瓦应用程序
- 11. java程序支持多种语言
- 12. 提供Movilizer应用程序的本地化/多语言支持
- 13. 如何给我的应用程序多语言支持?
- 14. 多语言支持
- 15. 多语言支持
- 16. 多语言支持测试应用程序/数据库
- 17. 如何为Android应用程序提供多语言支持
- 18. 多语言应用程序 - 社区支持?
- 19. Android多语言和少数语言支持语言不支持语言区域
- 20. Django的多语言支持
- 21. Mongodb的多语言支持
- 22. 在我的Android应用程序中只支持两种语言
- 23. 什么控制iTunes应用程序中支持的iPhone应用程序的语言列表?
- 24. 在Web应用程序中添加对多种语言的支持
- 25. 支持多种语言
- 26. Mysql utf8_unicode_ci多语言支持
- 27. Swift kitura多语言支持
- 28. SEO和多语言支持
- 29. Android多语言支持
- 30. 纯C语言的iPhone应用程序
查看本教程http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial 用于创建String文件 – aViNaSh