2012-04-30 5 views
6

내 응용 프로그램을 번역하려고하는데 자리 표시 자의 절반이있을 때 번역하기가 어렵습니다.자리 표시 자 및 NSLocalizedString

[textView1 insertText:[NSString stringWithFormat:NSLocalizedString(@"festaCompresaW, @""), nomeFesta, giornoFesta, meseFesta, annoFestaModificato, ggSett]]; 

그것을 : 나는 코드의 부분을 편집 한 다음

"festaCompresa" = @"%@ is the %i/%i/%i. the day of the week is %@. The holidays is included in the calculation. \n"; 

:

[textView1 insertText:[NSString stringWithFormat:@"%@ è il %i/%i/%i. Il giorno delle settimana è %@. La Festa è compresa nel calcolo. \n", nomeFesta, giornoFesta, meseFesta, annoFestaModificato, ggSett]]; 

내가 파일 localizable.string에 넣어 (영어) : 나는 다음과 같은 코드를 찾아야 작동하지 않습니다.

+0

어떻게 도움이되기를 바랍니다 :

"festaCompresa" = @"%@ is the %i/%i/%i. the day of the week is %@. The holidays is included in the calculation. \n"; 

이 될한다 정확히 작동하지 않습니까? – hamstergene

+0

단어 비교 때문에 화면이 올바르지 않습니다. festaCompresaW – Andrea

+0

또한 파일에 오류가 있습니다. 문자열 : 유효성 검사에 실패했습니다 : 데이터가 손상되어 읽을 수 없습니다. – Andrea

답변

4

코드를 복사하여 붙여 넣으셨습니까? 아니면 다시 타이핑 했습니까? 당신이 경우 복사 - 붙여 넣기 때문에 문제가있다 :

[textView1 insertText:[NSString stringWithFormat:NSLocalizedString(@"festaCompresaW, @""), nomeFesta, giornoFesta, meseFesta, annoFestaModificato, ggSett]]; 

나는

[textView1 insertText:[NSString stringWithFormat:NSLocalizedString(@"festaCompresa", @""), nomeFesta, giornoFesta, meseFesta, annoFestaModificato, ggSett]]; 

그래서 기본적으로 " 대신 W의를해야 가정합니다.

또한, Localizable.strings에 당신은 따옴표 앞에 @을 두지 않기 때문에이 :

"festaCompresa" = "%@ is the %i/%i/%i. the day of the week is %@. The holidays is included in the calculation. \n"; 

6
귀하의 문자열 파일은 사소한 오류가, 당신은이 NSString 상수 문자열 것처럼 @ 포함 시켰습니다

- 파일 형식이 따옴표로 문자열을 사용

"festaCompresa" = "%@ is the %i/%i/%i. the day of the week is %@. The holidays is included in the calculation. \n"; 

을 BTW : 현지화에 대한 형식 문자열을 만들 때 위치 형식을 사용해야 할 수도 있습니다. 여기서 각 형식 스펙에는 인수의 수가 포함됩니다. 예 :

"festaCompresa" = "%[email protected] is the %2$i/%3$i/%4$i. the day of the week is %@. The holidays is included in the calculation. \n"; 

위의 문자열에는 인수가 제공된 순서대로 포함되어 있으므로 분명히 필요하지 않습니다. 그러나 일부 언어에서는 다른 순서로 작성해야 할 수도 있습니다.