2011-11-19 2 views
1

아이폰 설정이 아닌 응용 프로그램 자체에서 언어를 변경할 수있는 iphone 응용 프로그램을 개발하고 싶습니다.iphone 응용 프로그램의 다국어 지원

어떻게 가능합니까? 사용할 수있는 자습서가 있습니까 ??

응답을 기다리는 중입니다.

감사합니다, Jagruti

+0

이 자습서 확인 http://www.raywenderlich.com/2876/how-to-localize-an-iphone-app-tutorial String 파일 만들기 – aViNaSh

답변

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을 만들고 는 두 문자열이 [YourAppDelegate getLocalvalue 아래의 값처럼 받기 를 들어 동일한 키를 부여 en.lproj : "설정"@를 ];