Lingo.dev + .strings (Xcode)
Lingo.dev CLI는 키-값 구조, 주석 및 iOS 현지화 규칙을 보존하면서 Xcode .strings 파일을 번역합니다. CLI는 구형 Xcode 프로젝트 및 워크플로우와 호환되며, 주석에 개발자 컨텍스트와 지침을 유지하고, %@
및 %d
와 같은 iOS 형식 지정자를 보존하며, UTF-16 및 UTF-8 인코딩을 적절히 처리하고, 표준 iOS 현지화 파이프라인과 통합됩니다.
빠른 설정
레거시 Xcode 문자열 파일 구성:
{
"locale": {
"source": "en",
"targets": ["es", "fr", "de", "ja"]
},
"buckets": {
"xcode-strings": {
"include": ["Resources/[locale].lproj/Localizable.strings"]
}
}
}
주의사항: [locale]
은 CLI 실행 중에 실제 로케일로 대체되므로 구성에서 문자 그대로 유지해야 하는 플레이스홀더입니다.
문자열 파일 번역
npx lingo.dev@latest i18n
값을 번역하는 동안 문자열 파일 형식, 개발자 주석 및 iOS 특정 규칙을 보존합니다.
문자열 파일 구조
기본 키-값 쌍
/* 메인 네비게이션 */
"nav.home" = "Home";
"nav.settings" = "Settings";
"nav.profile" = "Profile";
/* 인증 */
"auth.login" = "Log In";
"auth.logout" = "Log Out";
"auth.register" = "Sign Up";
형식 지정자
/* 플레이스홀더가 있는 사용자 메시지 */
"welcome.user" = "Welcome back, %@!";
"items.count" = "You have %d items in your cart";
"download.progress" = "Downloading... %.1f%% complete";
여러 줄 문자열
/* 긴 콘텐츠 */
"terms.agreement" = "By using this app, you agree to our terms of service and privacy policy. Please read them carefully before proceeding.";
"help.description" = "This feature helps you manage your tasks efficiently. You can create, edit, and organize your work items.";
iOS 특정 기능
현지화 주석
/* 하단 탭 바에 표시됨 */
"tab.home" = "홈";
/* 양식 제출 버튼 텍스트 */
"button.submit" = "제출";
/* 네트워크 사용 불가 시 오류 메시지 */
"error.network" = "인터넷 연결을 확인해 주세요";
개발자 주석은 번역가에게 컨텍스트를 제공합니다.
특수 문자
/* 따옴표와 특수 문자가 포함된 문자열 */
"message.quote" = "그녀가 \"안녕하세요!\"라고 말했습니다";
"path.file" = "Documents\\MyFile.txt";
"symbol.copyright" = "© 2024 회사명";
따옴표와 백슬래시에 대한 적절한 이스케이프 처리가 유지됩니다.
스토리보드 통합
/* 스토리보드 현지화 */
"A8K-3L-9X7.text" = "환영합니다";
"B9M-4N-0Y8.placeholder" = "이름을 입력하세요";
"C0P-5Q-1Z9.title" = "설정";
인터페이스 빌더에서 생성된 키가 올바르게 처리됩니다.
고급 구성
다중 문자열 파일
"xcode-strings": {
"include": [
"Resources/[locale].lproj/Localizable.strings",
"Resources/[locale].lproj/InfoPlist.strings"
]
}
시스템 키 잠금
"xcode-strings": {
"include": ["Resources/[locale].lproj/Localizable.strings"],
"lockedKeys": ["CFBundleName", "CFBundleDisplayName"]
}