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. Installshield多語言支持應用程序
- 2. Xamarin.Forms應用程序支持多語言
- 3. iphone多語言支持
- 4. 多語言支持iPhone?
- 5. iphone多語言支持
- 6. Iphone中的多語言應用程序
- 7. 通用應用程序中的多語言支持
- 8. 在應用程序中的多語言支持
- 9. Android - 在ViewPager中支持多語言應用程序
- 10. 如何在ASP.NET Web應用程序中支持多種語言?
- 11. 在Winforms應用程序中支持多種語言
- 12. 在Web應用程序中提供多語言支持
- 13. 多語言支持科爾多瓦應用程序
- 14. java程序支持多種語言
- 15. 顯示Android應用程序的多種語言支持
- 16. Android應用程序的多語言支持
- 17. 在應用程序的數據庫端支持多種語言
- 18. 如何給我的應用程序多語言支持?
- 19. 提供Movilizer應用程序的本地化/多語言支持
- 20. 多語言支持
- 21. 多語言支持
- 22. 電子郵件應用程序多語言支持實施
- 23. Android多語言鍵盤支持應用程序
- 24. 如何爲Android應用程序提供多語言支持
- 25. 多語言應用程序 - 社區支持?
- 26. 多語言支持測試應用程序/數據庫
- 27. Android應用支持多國語言
- 28. 在應用程序中使用不支持的語言
- 29. 如何將iPhone庫中所有支持的語言列入應用程序
- 30. 構建支持多語言的Web應用程序(例如英語,德語等)
查看本教程http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial 用於創建String文件 – aViNaSh