현지화 된 문자열 Xcode 4… .strings 파일 복사 오류 유효성 검사 실패
Xcode 4에서 지역화 된 문자열을 어떻게 정의합니까?
"Localization"속성 (파일 관리자, 오른쪽 패널)을 사용하여 InfoPlist.strings에 언어를 추가 할 수 있다고 가정했습니다.
... 그런 다음 각 지역화 된 버전에서 "키"= "값"을 입력합니다.
하지만 프로젝트를 만들 수 없습니다. 이 오류가 발생합니다.
.strings 파일 복사 오류 유효성 검사 실패 : 데이터가 손상되어 읽을 수 없습니다.
텍스트 인코딩을 UTF 16으로 변환해도 문제가 해결되지 않습니다. Xcode를 종료하고 다시 시작하지도 않습니다.
Q1 : 이러한 빌드 오류를 어떻게 해결합니까?
우연으로 나는 한때 InfoPlist.strings (프랑스어) 및 (영어)를 추가하여 실행할 테스트 앱을 얻었습니다. 프랑스어 문자열 파일에서 오류가 발생하지 않았지만 영어로 오류가 발생했습니다. 그래서 저는 영어를 그대로두고 프랑스어에 매개 변수를 넣었습니다. 그러나 시뮬레이터에서 프랑스어로 설정하면 매개 변수가 선택되지 않았습니다. NSLocalizedString ()에 지정된 기본값으로 되돌 렸습니다.
Q2 : 빌드 오류가 해결 된 경우에도 작동하게하려면 어떻게해야합니까?
줄 끝에 세미콜론이 누락 된 것처럼 간단 할 수 있습니다.
현지화 파일 내에서 오류를 찾는 문제가 동일했습니다.
터미널에서 plutil 도구를 사용하여 파일을 변환하면 줄 번호와 함께 적절한 오류 메시지가 표시됩니다.
plutil -lint Localizable.strings
응답
plutil [74058 : 707] CFPropertyListCreateFromXMLData () : 구식 plist 파서 : 422 행의 사전에 세미콜론이 없습니다. 파싱이 중단됩니다. 디버그하려면 _CFPropertyListMissingSemicolon을 중단하십시오. Localizable.strings : 1 행에 예기치 않은 문자 "
예, 500 개의 번역을 통해 검색했습니다.
두 번째 문자열의 KISS는 다른 DOUBLE QUOTES ERROR 내부에있는 큰 따옴표 안에 있습니다.
"Before using KISS Remixer, you must agree to the terms and conditions of use." = "Vor der Nutzung des Remixers "KISS" müssen Sie die Allgemeinen Geschäftsbedingungen akzeptieren.";
괜찮아
"Before using KISS Remixer, you must agree to the terms and conditions of use." = "Vor der Nutzung des Remixers KISS müssen Sie die Allgemeinen Geschäftsbedingungen akzeptieren.";
이대로 (더블 내부에 작은 따옴표로 대체)
"Before using KISS Remixer, you must agree to the terms and conditions of use." = "Vor der Nutzung des Remixers 'KISS' müssen Sie die Allgemeinen Geschäftsbedingungen akzeptieren.";
팁 문제가되는 줄을 찾으려면 이진 검색을 사용하십시오.
- 번역기에서 현지화 된 파일을 다시 가져옵니다.
- 모든 Loclaizable.strings를 프로젝트 지역화 된 폴더에 복사합니다.
- XCODE 열기
- 모두 정리-iOS 기기 / 모든 시뮬레이터에서
- 짓다
- .strings 파일 복사 오류 유효성 검사 실패 : 데이터가 손상되어 읽을 수 없습니다.
- 로그 탐색기 열기
- 어떤 번역이 손상되었는지 확인하십시오.
- TextWrangler에서 Localizable.strings를 열었습니다. 도구 모음의 하단에 Translator가 UTF-16 파일을 다음과 같이 다시 보냈습니다.
UTF-16 Little Endian이 다시 'UTF-16'으로 변경했습니다. 10. 빌드 / 빌드 동일한 오류가 정리되었습니다.
파일의 어딘가에
세미콜론이 누락 되었습니까?
/* popup message */
"Save mix" = "Enregistrer le mixage";
/* popup message */
"Save mix" = "Enregistrer le mixage"
"큰 따옴표 안에 추가"큰 따옴표 ""
잘못된
/* popup message */
"Save mix" = "Enregistrer le "mix" age"
권리
/* popup message */
"Save mix" = "Enregistrer le mixage"
또한 옳다
/* popup message */
"Save mix" = "Enregistrer le 'mix'age"
- 두 곳에서 큰 따옴표로 묶인 "KISS"를 찾은 파일에 하나 이상의 오류가있을 수 있음을 기억하십시오.
파일 인코딩을 확인하십시오. 이는 종종 확장 문자 (예 : 악센트 부호가있는 문자) 및 비 UTF 인코딩으로 인해 발생합니다. 특히 XCode 4에는 Safari에서 악센트 부호가있는 문자를 문자열 파일로 복사하면 Western Mac OS Roman으로 저장되는 버그가 있습니다.
XCode의 구문 검사기가 이것을 알아낼 수 없다는 것은 부끄러운 일입니다.
You can also copy the text into Text Wrangler (something I do after receiving a file from a translator) to check for properly quoted strings or run a regex checking for semicolons. The syntax coloring in Text Wrangler will show mis-quoted (or mis-escaped) strings where XCode's strings editor currently does not.
In my case, plutil -lint Localizable.strings
didn't help because the error message it produced was "Unexpected character " at line 1
" when the real error was a ”
instead of a "
on line 2340.
In my case, it was a problem of "quote" sign copy-pasted from a website, that was not accepted.
I should have detected that from syntax-highlighting not working, but I just read the source "quote sign, key, quote sign, equality sign, quote sign, value, quote sign... yup okay".
If you use double quotation "" in your localisation, don't forget to escape them using a back slash.
One should Check syntax like this
"Recharge_Data" = "Data";
1) "" should be there on proper place.
2) = should be checked.
3) ; should be there at end of statement.
I have had the same problem. I had a about 60 pages long localization file, and had just one " too many - took a while to spot that
I'd the same issue for a big localized file from an hour and apply all above steps won't solve my problem, finally what I am done with is, devide localize file into some ranges (parts), say part-a, b, c ... and cut those strings from file, and keep those in a text file, build the project again, unless and until I reached to the point, where only part-k was left, I found that by mistakenly I pressed f on my keyboard..fewww! it solved. I know this is not a solution but may be help to someone like me:)
My friend did translation for me in Windows. I found, that changing encoding doesn't help, so what I did: I commented all of the strings, and then I uncommented a few and pressed cmd-B, to find out which strings had problems. Then I rewrote problem strings manually and after that it worked.
'IT Share you' 카테고리의 다른 글
PHP에서 16 진수 색상을 RGB 값으로 변환 (0) | 2020.11.15 |
---|---|
Android 리소스를 찾을 수 없음 예외? (0) | 2020.11.15 |
BroadcastReceiver가 BOOT_COMPLETED를 수신하지 않습니다. (0) | 2020.11.15 |
자바 : 오래된 것, 새로운 것 (0) | 2020.11.15 |
Java에서이 줄은 무엇을 의미합니까? boolean retry = id == 1; (0) | 2020.11.15 |