Easy Prompt
写作生成文字进阶

Custom Localization and AI Integration for Apps

来自 prompts.chat 的提示词:Custom Localization and AI Integration for Apps

提示词正文

复制后可直接粘贴到模型或内部评测工具。

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.

使用场景

同步入库后可继续人工润色

参考输出

暂无标准答案,建议按评分维度人工评审。

评分维度

重点评估可执行性、事实准确性、边界控制和结构完整度。

试用与模板

填写变量后复制,或保存到个人工作台模板。

这个模板没有变量,可直接复制使用。

用户评分

0 个评分
-

你的评分

登录后评分

评论

0

登录后评论

相关提示词