+ Accurately and concisely covers the core architecture.
- It omits actual catalog translations and executed test results.
an App Localization Expert. You are tasked with setting up a user-preference-based localization architecture in an application independent of the phon
| Category | Development › Coding |
|---|---|
| Tags | DraftingTranslatingDeveloperCode |
Act as an App Localization Expert. You are tasked with setting up a user-preference-based localization architecture in an application independent of the phone's system language.
Your task includes:
1. **LanguageManager Class**: Create a `LanguageManager` class using the `ObservableObject` protocol. Store the user's selected language in `UserDefaults`, with the default language set to 'en' (English). Display a selection screen on the first launch.
2. **Global Locale Override**: Wrap the entire `ContentView` structure in your SwiftUI app with `.environment(\.locale, .init(identifier: languageManager.selectedLanguage))` to trigger translations based on the selected language in `LanguageManager`.
3. **Onboarding Language Selection**: If no language has been selected previously, show a stylish 'Language Selection' screen with English and Turkish options on app launch. Save the selection immediately and transition to the main screen.
4. **AI (LLM) Integration**: Add the user's selected language as a parameter in AI requests (API calls). Update the system prompt to: 'User's preferred language: ${selected_language}. Respond in this language.'
5. **String Catalogs**: Integrate `.stringxcatalog` into your project and add all existing hardcoded strings in English (base) and Turkish.
6. **Dynamic Update**: Ensure that changing the language in settings updates the UI without restarting the app.
7. **User Language Change**: Allow users to change the app's language dynamically at any time.
Rules:
- Ensure seamless user experience during language selection and updates.
- Test functionality for both English and Turkish languages.This prompt designs app localization independent of the device language as an App Localization Expert. It includes English and Turkish string catalogs, dynamic language changes, and adding the selected language to AI system prompts.
ChatGPT is the most accurate and complete. Gemini is specific but overly long and incomplete, while [C] is missing.
+ Accurately and concisely covers the core architecture.
- It omits actual catalog translations and executed test results.
+ Provides concrete onboarding, settings, and AI integration code.
- It is truncated and does not save immediately upon selection.
| Criterion | ChatGPT | Gemini | Leader |
|---|---|---|---|
| Instruction following | 8 | 6 | ChatGPT +33% |
| Accuracy | 9 | 7 | ChatGPT +29% |
| Specificity | 8 | 9 | Gemini +13% |
| Structure | 9 | 7 | ChatGPT +29% |
| Right length | 8 | 4 | ChatGPT +100% |
Scored 1–10 by gpt-5.6-sol with model names hidden (2026-09-25). This is an AI review, not a measurement.
We gave three models the same input and copied their answers unedited. Each ran in its CLI (an agent harness), and answers in the ChatGPT or Claude apps or on the web may differ. Outputs are in Korean.
현재 작업 공간이 읽기 전용이고 터미널/파일 편집 권한도 없어 실제 프로젝트 파일을 수정하거나 테스트할 수 없습니다. 대신 적용해야 할 구조는 다음과 같습니다.
LanguageManager.swift
import SwiftUI
@MainActor
final class LanguageManager: ObservableObject {
private let languageKey = "selectedLanguage"
private let didSelectLanguageKey = "didSelectLanguage"
@Published var selectedLanguage: String {
didSet {
UserDefaults.standard.set(selectedLanguage, forKey: languageKey)
}
}
@Published private(set) var hasSelectedLanguage: Bool
init() {
selectedLanguage =
UserDefaults.standard.string(forKey: languageKey) ?? "en"
hasSelectedLanguage =
UserDefaults.standard.bool(forKey: didSelectLanguageKey)
}
func selectLanguage(_ language: String) {
selectedLanguage = language
hasSelectedLanguage = true
UserDefaults.standard.set(true, forKey: didSelectLanguageKey)
}
}
앱 진입점에서 전체 화면에 Locale을 적용합니다.
@main
struct MyApp: App {
@StateObject private var languageManager = LanguageManager()
var body: some Scene {
WindowGroup {
Group {
if languageManager.hasSelectedLanguage {
ContentView()
} else {
LanguageSelectionView()
}
}
.environmentObject(languageManager)
.environment(
\.locale,
Locale(identifier: languageManager.selectedLanguage)
)
}
}
}
첫 실행 언어 선택 화면:
struct LanguageSelectionView: View {
@EnvironmentObject private var languageManager: LanguageManager
var body: some View {
VStack(spacing: 24) {
Text("language_selection_title")
.font(.largeTitle.bold())
Text("language_selection_subtitle")
.foregroundStyle(.secondary)
Button {
languageManager.selectLanguage("en")
} label: {
Text("language_english")
.frame(maxWidth: .infinity)
}
.buttonStyle(.borderedProminent)
Button {
languageManager.selectLanguage("tr")
} label: {
Text("language_turkish")
.frame(maxWidth: .infinity)
}
.buttonStyle(.bordered)
}
.padding(32)
}
}
설정 화면에서는 동일한 selectLanguage 메서드를 호출하면 앱 재시작 없이 UI가 갱신됩니다.
struct LanguageSettingsView: View {
@EnvironmentObject private var languageManager: LanguageManager
var body: some View {
Picker("language", selection: Binding(
get: { languageManager.selectedLanguage },
set: { languageManager.selectLanguage($0) }
)) {
Text("language_english").tag("en")
Text("language_turkish").tag("tr")
}
.pickerStyle(.menu)
}
}
AI 요청에는 선택 언어와 시스템 프롬프트를 함께 전달합니다.
struct AIRequest: Encodable {
let prompt: String
let preferredLanguage: String
let systemPrompt: String
init(prompt: String, language: String) {
self.prompt = prompt
self.preferredLanguage = language
self.systemPrompt =
"User's preferred language: \(language). Respond in this language."
}
}
문자열 카탈로그는 Xcode의 .xcstrings 형식을 사용해야 합니다. 사용자가 언급한 .stringxcatalog는 Apple의 실제 String Catalog 확장자가 아닙니다. 다음 키를 영어와 터키어로 등록하면 됩니다.
language_selection_title
language_selection_subtitle
language_english
language_turkish
language
SwiftUI에서는 모든 사용자 노출 문자열을 다음처럼 키 기반으로 사용합니다.
Text("language_selection_title")
Text("language_english")
검증 항목:
en 저장tr 저장preferredLanguage 및 시스템 프롬프트 확인실제 적용과 테스트를 완료하려면 프로젝트 파일 쓰기 권한이 필요합니다.
| 12-Month AI and Computer Vision Roadmap for Defense Applications | |
| 2046 Puzzle Game Challenge | |
| 21st.dev component prompt | |
| 3D FACTORY | |
| 3D FPS Game |