2012-03-04 4 views
0

프로젝트의 현지화 마지막 부분을 완료하고 있습니다. 번역 된 텍스트가 .txt와 .docx 형식으로 나뉘어 나에게 돌아왔다.xcode에 한국어 현지화 텍스트 가져 오기 관련 문제

일단 localizable.strings에 입력 된 .txt는 정상적으로 작동하지만 워드 문서에서 복사 된 것은 작동하지 않습니다.

  • 이 .txt로 .DOCX 저장하자 워드 인코딩
  • 을 한국어로 (맥 OS X)를 .txt 인 저장 다음이 텍스트를 복사 :

    내가 지금까지 시도한 것입니다 엑스 코드와 (맥 OS X)를 한국의 재 해석, 다음 변환은 UTF-16

는 UTF-16로 변환 많은 옵션을 시도했지만, 그냥 균열 수없는 것. 어떤 아이디어라도 높이 평가할 수 있습니다. 워드 문서를 포함하는 일

helpText = [NSArray arrayWithObjects: 
       [NSDictionary dictionaryWithObjectsAndKeys: 
       NSLocalizedString(@" The Actions Tab", nil), kHelpTextKeyString, 
       @"Arial", kHelpTextKeyFontName, 
       [NSNumber numberWithInt:20], kHelpTextKeyFontSize, 
       [[UIColor blackColor] CGColor], kHelpTextKeyColor, 
       CGRectCreateDictionaryRepresentation(CGRectMake(30.0, 55.0, 200.0, 28.0)), kHelpTextKeyRect, 
       nil], 
       [NSDictionary dictionaryWithObjectsAndKeys: 
       [NSArray arrayWithObjects: 
        NSLocalizedString(@" 

- (void)displaySelectedHelpImage:(UIImage *)orgImage withTextArray:(NSArray *)textArr { 
CGImageRef cgImage = [orgImage CGImage]; 
int pixelsWide    = CGImageGetWidth(cgImage); 
int pixelsHigh    = CGImageGetHeight(cgImage); 
int bitsPerComponent  = CGImageGetBitsPerComponent(cgImage);//8; // fixed 
int bitsPerPixel   = CGImageGetBitsPerPixel(cgImage);//bitsPerComponent * numberOfCompnent; 
int bytesPerRow    = CGImageGetBytesPerRow(cgImage);//(pixelsWide * bitsPerPixel) // 8; // bytes 
int byteCount    = (bytesPerRow * pixelsHigh); 
CGColorSpaceRef colorSpace = CGImageGetColorSpace(cgImage);//CGColorSpaceCreateDeviceRGB(); 

// Allocate data 
NSMutableData *data = [NSMutableData dataWithLength:byteCount]; 
// Create a bitmap context 
CGContextRef context = CGBitmapContextCreate([data mutableBytes], pixelsWide, pixelsHigh, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast); //kCGImageAlphaPremultipliedLast);//kCGImageAlphaNoneSkipLast); //kCGImageAlphaOnly); 
// Set the blend mode to copy to avoid any alteration of the source data or to invert to invert image 
CGContextSetBlendMode(context, kCGBlendModeCopy); 
// Set alpha 
CGContextSetAlpha(context, 1.0); 
// Color image 
//CGContextSetRGBFillColor(context, 1 ,1, 1, 1.0); 
//CGContextFillRect(context, CGRectMake(0.0, 0.0, pixelsWide, pixelsHigh)); 
// Draw the image to extract the alpha channel 
CGContextDrawImage(context, CGRectMake(0.0, 0.0, pixelsWide, pixelsHigh), cgImage); 

// add text to image 
// Changes the origin of the user coordinate system in a context 
//CGContextTranslateCTM (context, pixelsWide, pixelsHigh); 
// Rotate context upright 
//CGContextRotateCTM (context, -180. * M_PI/180); 
for (NSDictionary *dic in textArr) { 

    CGContextSelectFont (context, 
         //todo 
         [[dic objectForKey:kHelpTextKeyFontName] UTF8String], 
         [[dic objectForKey:kHelpTextKeyFontSize] intValue], 
         kCGEncodingMacRoman); 
    CGContextSetCharacterSpacing (context, 2); 
    CGContextSetTextDrawingMode (context, kCGTextFillStroke); 

    CGColorRef color = (CGColorRef)[dic objectForKey:kHelpTextKeyColor]; 
    CGRect rect; 
    CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[dic objectForKey:kHelpTextKeyRect], &rect); 

    CGContextSetFillColorWithColor(context, color); 
    CGContextSetStrokeColorWithColor(context, color); 

    if ([[dic objectForKey:kHelpTextKeyString] isKindOfClass:[NSArray class]]) { 
     for (NSString *str in [dic objectForKey:kHelpTextKeyString]) { 
      CGContextShowTextAtPoint(context, 
            rect.origin.x, 
            pixelsHigh - rect.origin.y, 
            [str cStringUsingEncoding:[NSString defaultCStringEncoding]], 
            [str length]); 
      rect.origin.y += [[dic objectForKey:kHelpTextKeyFontSize] intValue]; 
     } 

답변

0

:

여기

는 지역화 된 도움말보기 구현? "일하지 않는다"는 것은 무엇을 의미합니까?

문자열이 포함 된 경우 기존의 localizable.strings 파일에 추가 할 수 없었습니까? 이 파일에는 인코딩 문제가 없으므로 Word에서 Xcode의 localizable.strings 파일로 복사/붙여 넣기 만하면됩니다.

+0

답장을 보내 주셔서 감사합니다. 예, 그것이 제가 시도한 것입니다. 나는 그 이후로 단어와 아무 관련이 없음을 발견했습니다. 그것은 nonwestern 문자를 표시하는 문제가있는 customview입니다. – Zeb99

+0

다른 사람들이이 문제에 걸려 넘어 졌을 때를 대비하여 여기에 해결책을 게시 해 드리겠습니다. – Zeb99

+0

한국어 텍스트를 UTF-16으로 변환했지만 문제가 해결되지 않았습니다. 현지화 된 도움말 화면은 나 자신이 아닌 다른 사람이 개발했습니다. 그들이 표시되는 방식은 비 서구인의 문제를 일으키는 것으로 보입니다. – Zeb99

1

이 문제를 겪고있는 사람은 coretext 기초 클래스를 사용하여 해결되었습니다.