React Native(Expo)输入与相机默认选项语言适配问题咨询
Hey there! I’ve dealt with this exact localization issue in Expo apps before, so let’s break down the steps to get those default system menus (paste/cut for inputs, camera controls) to follow your phone’s system language.
1. Configure App Localization in app.json
This is the foundational step—Expo needs to know which languages your app supports to sync with the system locale.
Add supported languages to Expo’s core config:
In yourapp.json, update theexpo.localizationsarray to include all languages you want to support (e.g., Simplified Chinese and English):"expo": { "localizations": ["zh-Hans", "en"], // ... other configs }iOS-specific tweaks:
Add these settings to theios.infoPlistsection to ensure iOS recognizes your app’s language support and follows the system default:"ios": { "infoPlist": { "CFBundleDevelopmentRegion": "$(DEVELOPMENT_LANGUAGE)", "CFBundleLocalizations": ["zh-Hans", "en"] } // ... other iOS configs }Android-specific tweaks:
Define supported locales in theandroid.resources.localessection to let Android sync the native menus with the system language:"android": { "resources": { "locales": [ {"name": "zh-rCN", "type": "default"}, {"name": "en-rUS"} ] } // ... other Android configs }
2. Sync Camera Controls with System Language
Expo’s Camera component might not automatically pick up the system locale, so we’ll explicitly pass it using expo-localization:
First, install the package:
npx expo install expo-localizationImport and use it in your Camera screen:
import * as Localization from 'expo-localization'; import { Camera } from 'expo-camera'; // In your component const systemLocale = Localization.locale; return ( <Camera locale={systemLocale} // ... other Camera props (style, type, etc.) /> );This tells the Camera component to use the exact locale your phone is set to, which translates its default controls (like capture button labels, permissions prompts) accordingly.
3. Verify & Troubleshoot
- Restart your dev environment: After modifying
app.json, you’ll need to restart the Expo server and rebuild your app (or refresh the Expo Go app if you’re using it—though custom dev clients are more reliable for localization testing). - Test system language switch: Change your phone’s system language, restart the app, and check if the TextInput context menus (paste/cut/select) and Camera controls update to the new language.
- Check Expo SDK version: Older SDK versions might have bugs with native component localization. If you’re on an older version, consider upgrading to the latest stable SDK.
If you still see English menus after these steps, double-check that your app.json config is correctly formatted and that you’ve included the exact language code matching your system’s locale (e.g., zh-Hans for Simplified Chinese, zh-Hant for Traditional Chinese).
内容的提问来源于stack exchange,提问作者Ayyoub

